From aa85cb7a8af20c64c056a966a8bba9924ae56bc8 Mon Sep 17 00:00:00 2001 From: Didier Raboud Date: Wed, 23 May 2012 10:43:38 +0200 Subject: [PATCH] PyUT: Implement test for lsb_release.get_distro_information. --- test/test_lsb_release.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/test_lsb_release.py b/test/test_lsb_release.py index 50c8995..87e5af0 100644 --- a/test/test_lsb_release.py +++ b/test/test_lsb_release.py @@ -261,9 +261,21 @@ class TestLSBRelease(unittest.TestCase): self.assertEqual(lr.get_lsb_information(),supposed_output) os.environ.pop('LSB_ETC_LSB_RELEASE') - @unittest.skip('Test not implemented.') def test_get_distro_information(self): - raise NotImplementedError() + # Test that an inexistant /etc/lsb-release leads to empty output + supposed_output = get_arch_distinfo() + supposed_output['RELEASE'] = 'testing/unstable'; + supposed_output['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s' % supposed_output + + os.environ['LSB_ETC_LSB_RELEASE'] = 'test/inexistant_file_' + rnd_string(2,5) + fn = 'test/debian_version_' + rnd_string(5,12) + f = open(fn,'w') + f.write('testing/sid') + f.close() + os.environ['LSB_ETC_DEBIAN_VERSION'] = fn + self.assertEqual(lr.get_distro_information(),supposed_output) + os.remove(fn) + os.environ.pop('LSB_ETC_DEBIAN_VERSION') if __name__ == '__main__': unittest.main() -- 2.30.2