diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-08-05 14:43:14 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-08-05 14:43:14 +0200 |
commit | 95620b53bcdf68843cd210306bb7228bfee3239c (patch) | |
tree | 71e1578814515cdc67cfd9fff230d98d4b5fd99f /tests/test_distro.py | |
parent | a0aa1dd751453a3557f16912cc5cfe1225eb3253 (diff) | |
parent | 20df31b862f3fbb274a4bb4952a84a53b73238a0 (diff) |
Merge tag 'debian/0.0.8-2' into bpo/wheezy
whatmaps Debian release 0.0.8-2
Diffstat (limited to 'tests/test_distro.py')
-rw-r--r-- | tests/test_distro.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/test_distro.py b/tests/test_distro.py index e22da68..88fa984 100644 --- a/tests/test_distro.py +++ b/tests/test_distro.py @@ -16,9 +16,15 @@ import unittest -from whatmaps.distro import Distro +from mock import patch -from . import context +try: + import lsb_release + have_lsb_release=True +except ImportError: + have_lsb_release=False + +from whatmaps.distro import Distro, detect class Pkg(object): name = 'doesnotmatter' @@ -38,3 +44,13 @@ class TestDistro(unittest.TestCase): self.assertEqual(Distro.pkg_services(Pkg), []) self.assertEqual(Distro.pkg_service_blacklist(Pkg), []) self.assertFalse(Distro.has_apt()) + + + @unittest.skipUnless(have_lsb_release, "lsb_release not installed") + def test_detect_via_lsb_release_module(self): + "Detect distro via lsb_release" + with patch('lsb_release.get_distro_information', return_value={'ID': 'Debian'}): + # Make sure we don't use the fallback + with patch('os.path.exists', return_value=False): + d = detect() + self.assertEqual(d.id, 'Debian') |