From 2b21e13aadd322b1a58c730a99a9aafb6bab1f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 27 Mar 2017 08:55:08 +0200 Subject: [PATCH] Skip DNF tests if there are import problems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If there are import errors for DNF, multilib or other related package, we can assume the tests are running on EPEL. The DNF tests should be skipped in that case. Signed-off-by: Lubomír Sedlář --- tests/test_gather.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_gather.py b/tests/test_gather.py index ebe0978d..f532837b 100644 --- a/tests/test_gather.py +++ b/tests/test_gather.py @@ -18,8 +18,12 @@ sys.path.insert(0, os.path.join(HERE, '..')) os.environ['PATH'] = '%s:%s' % (BINDIR, os.environ['PATH']) from pungi.wrappers.pungi import PungiWrapper -from pungi.dnf_wrapper import DnfWrapper, Conf -from pungi.gather_dnf import Gather, GatherOptions, PkgFlag +try: + from pungi.dnf_wrapper import DnfWrapper, Conf + from pungi.gather_dnf import Gather, GatherOptions, PkgFlag + HAS_DNF = True +except ImportError: + HAS_DNF = False def convert_pkg_map(data): @@ -1621,6 +1625,7 @@ def convert_dnf_packages(pkgs, flags): return sorted(result) +@unittest.skipUnless(HAS_DNF, 'Dependencies are not available') class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): def setUp(self): super(DNFDepsolvingTestCase, self).setUp()