avoid skipIf in import-comps unit test

causes problems with unittest2 in epel6
This commit is contained in:
Mike McLean 2018-04-30 19:44:04 -04:00
parent a094ab21c4
commit 9de0b15292

View file

@ -18,6 +18,8 @@ try:
except ImportError:
yumcomps = None
from nose.plugins.skip import SkipTest
import koji_cli.commands
from koji_cli.commands import handle_import_comps, _import_comps,\
_import_comps_alt
@ -221,9 +223,10 @@ class TestImportComps(unittest.TestCase):
else:
self.assertEqual(cm.exception.code, 2)
@unittest.skipIf(libcomps is None, "No libcomps")
@mock.patch('sys.stdout', new_callable=six.StringIO)
def test_import_comps_libcomps(self, stdout):
if libcomps is None:
raise SkipTest('no libcomps')
comps_file = os.path.dirname(__file__) + '/data/comps-example.xml'
stdout_file = os.path.dirname(
__file__) + '/data/comps-example.libcomps.out'
@ -236,9 +239,10 @@ class TestImportComps(unittest.TestCase):
calls_file,
stdout)
@unittest.skipIf(libcomps is None, "No libcomps")
@mock.patch('sys.stdout', new_callable=six.StringIO)
def test_import_comps_sample_libcomps(self, stdout):
if libcomps is None:
raise SkipTest('no libcomps')
comps_file = os.path.dirname(__file__) + '/data/comps-sample.xml'
stdout_file = os.path.dirname(
__file__) + '/data/comps-sample.libcomps.out'
@ -251,11 +255,12 @@ class TestImportComps(unittest.TestCase):
calls_file,
stdout)
@unittest.skipIf(yumcomps is None, "No yum.comps")
@mock.patch('sys.stdout', new_callable=six.StringIO)
@mock.patch('koji_cli.commands.libcomps', new=None)
@mock.patch('koji_cli.commands.yumcomps', create=True, new=yumcomps)
def test_import_comps_yumcomps(self, stdout):
if yumcomps is None:
raise SkipTest('no yum.comps')
comps_file = os.path.dirname(__file__) + '/data/comps-example.xml'
stdout_file = os.path.dirname(
__file__) + '/data/comps-example.yumcomps.out'
@ -268,11 +273,12 @@ class TestImportComps(unittest.TestCase):
calls_file,
stdout)
@unittest.skipIf(yumcomps is None, "No yum.comps")
@mock.patch('sys.stdout', new_callable=six.StringIO)
@mock.patch('koji_cli.commands.libcomps', new=None)
@mock.patch('koji_cli.commands.yumcomps', create=True, new=yumcomps)
def test_import_comps_sample_yumcomps(self, stdout):
if yumcomps is None:
raise SkipTest('no yum.comps')
comps_file = os.path.dirname(__file__) + '/data/comps-sample.xml'
stdout_file = os.path.dirname(
__file__) + '/data/comps-sample.yumcomps.out'