diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-07-11 20:53:45 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-07-11 20:53:45 +0200 |
commit | 0b81cf5d788a1432f4f553a7ea18c5cc48f4eb96 (patch) | |
tree | 8f2189bf38f65adb90b2b2d49c959de5bec48f53 /tests/test_distro.py | |
parent | c6168dff875c9488a26f6931b9da52080a022b9b (diff) | |
parent | 5e9df7763328f998805b28aff874b56b67d1bd88 (diff) |
Merge tag 'v0.0.8' into debian/master
whatmaps 0.0.8
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') |