From: Didier Raboud Date: Wed, 23 May 2012 08:43:38 +0000 (+0200) Subject: PyUT: Implement test for lsb_release.get_distro_information. X-Git-Tag: archive/raspbian/10.2018112800+rpi1^2~110 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=aa85cb7a8af20c64c056a966a8bba9924ae56bc8;p=lsb.git PyUT: Implement test for lsb_release.get_distro_information. --- 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()