gns-deb-diff

automate the documentation of the differences between gNewSense and Debian.
git clone git://git.ricketyspace.net/gns-deb-diff.git
Log | Files | Refs

commit 80a69d5bf50f61b8a311c93b8474dc64e55e6fd0
parent d35105f158819f0f731a4efc7e138905ef8e627d
Author: rsiddharth <s@ricketyspace.net>
Date:   Wed, 11 Jan 2017 03:22:28 +0000

Make some tests mock $HOME

* tests/test_gd_diff.py: (test_read_config_file_fail,
test_read_gns_readme, test_read_gns_readme_none): Update tests.

Diffstat:
tests/test_gd_diff.py | 23+++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py @@ -132,8 +132,9 @@ class TestGdDiff(object): def test_read_config_file_fail(self): - config = read_config_file() - assert_equal(config, False) + with mock.patch('os.getenv', new=self.env_func): + config = read_config_file() + assert_equal(config, False) def test_read_config_file_success(self): @@ -309,18 +310,20 @@ class TestGdDiff(object): def test_read_gns_readme(self): - # first download the antlr readme - saved = slurp_gns_readme('parkes', 'antlr') - assert saved + with mock.patch('os.getenv', new=self.env_func): + # first download the antlr readme + saved = slurp_gns_readme('parkes', 'antlr') + assert saved - antlr_readme_content = read_gns_readme('parkes', 'antlr') - expected_antlr_readme_content = 'Changed-From-Debian: Removed example with non-free files.\nChange-Type: Modified\n\nFor gNewSense, the non-free unicode.IDENTs files are *actually* removed (see\nalso README.source). See gNewSense bug #34218 for details.\n' - assert_equal(antlr_readme_content, expected_antlr_readme_content) + antlr_readme_content = read_gns_readme('parkes', 'antlr') + expected_antlr_readme_content = 'Changed-From-Debian: Removed example with non-free files.\nChange-Type: Modified\n\nFor gNewSense, the non-free unicode.IDENTs files are *actually* removed (see\nalso README.source). See gNewSense bug #34218 for details.\n' + assert_equal(antlr_readme_content, expected_antlr_readme_content) def test_read_gns_readme_none(self): - readme_content = read_gns_readme('parkes', 'non-existent-pkg') - assert_equal(readme_content, None) + with mock.patch('os.getenv', new=self.env_func): + readme_content = read_gns_readme('parkes', 'non-existent-pkg') + assert_equal(readme_content, None) def test_slurp_fields_from_readme(self):