tests: Skip testing pdc logs if dependencies are not installed

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ář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-10-30 08:21:21 +01:00
parent 463fb961bc
commit 6f21576921
1 changed files with 8 additions and 0 deletions

View File

@ -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')