From 6f21576921ca5857a3e1971b4ceed00071e4977a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 30 Oct 2017 08:21:21 +0100 Subject: [PATCH] tests: Skip testing pdc logs if dependencies are not installed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On EPEL 6 modulemd is not available, so the test fails with an import error. We should just skip this particular tests, as the rest of the functionality is still perfectly fine. Signed-off-by: Lubomír Sedlář --- tests/test_pkgset_source_koji.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py index 8d7b51f4..6ea17166 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -10,6 +10,13 @@ import re sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) +try: + import modulemd # noqa + import pdc_client # noqa + HAS_MODULE_SUPPORT = True +except ImportError: + HAS_MODULE_SUPPORT = False + from pungi.phases.pkgset.sources import source_koji from tests import helpers @@ -118,6 +125,7 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase): with open(self.pkgset_path) as f: self.assertEqual(f.read(), 'DATA') + @unittest.skipUnless(HAS_MODULE_SUPPORT, 'Modulemd/pdc_client are not available') # noqa @mock.patch('six.moves.cPickle.dumps') @mock.patch('pungi.phases.pkgset.pkgsets.KojiPackageSet') @mock.patch('pungi.phases.pkgset.sources.source_koji.get_module')