diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 07c08d02..0327d0fa 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -2,6 +2,7 @@ import mock +import six import os import sys @@ -101,14 +102,16 @@ class TestBuildinstallPhase(PungiTestCase): # Server.x86_64, Client.amd64, Server.x86_64 pool = poolCls.return_value self.assertEqual(3, len(pool.queue_put.mock_calls)) - self.assertItemsEqual( + six.assertCountEqual( + self, [call[0][0][3] for call in pool.queue_put.call_args_list], ['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir, 'rm -rf %s/work/amd64/buildinstall/Server && lorax ...' % self.topdir, 'rm -rf %s/work/x86_64/buildinstall/Server && lorax ...' % self.topdir]) # Obtained correct lorax commands. - self.assertItemsEqual( + six.assertCountEqual( + self, loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1', '1', [self.topdir + "/work/x86_64/repo/p1", @@ -146,7 +149,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')]) - self.assertItemsEqual( + six.assertCountEqual( + self, get_volid.mock_calls, [mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='DVD'), mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='DVD'), @@ -174,7 +178,7 @@ class TestBuildinstallPhase(PungiTestCase): pool = poolCls.return_value self.assertEqual(1, len(pool.queue_put.mock_calls)) - self.assertItemsEqual( + self.assertEqual( [call[0][0][3] for call in pool.queue_put.call_args_list], ['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir]) @@ -193,7 +197,7 @@ class TestBuildinstallPhase(PungiTestCase): rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')], any_order=True) - self.assertItemsEqual( + self.assertEqual( get_volid.mock_calls, [mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd')]) @@ -221,7 +225,8 @@ class TestBuildinstallPhase(PungiTestCase): self.assertEqual(2, len(pool.queue_put.mock_calls)) # Obtained correct lorax commands. - self.assertItemsEqual( + six.assertCountEqual( + self, loraxCls.return_value.get_buildinstall_cmd.mock_calls, [mock.call('Test', '1', '1', [self.topdir + "/work/x86_64/repo/p1"], self.topdir + '/work/x86_64/buildinstall', @@ -229,7 +234,8 @@ class TestBuildinstallPhase(PungiTestCase): mock.call('Test', '1', '1', [self.topdir + "/work/amd64/repo/p1"], self.topdir + '/work/amd64/buildinstall', buildarch='amd64', is_final=True, volid='vol_id')]) - self.assertItemsEqual( + six.assertCountEqual( + self, get_volid.mock_calls, [mock.call(compose, 'x86_64', disc_type='DVD'), mock.call(compose, 'amd64', disc_type='DVD')]) @@ -276,14 +282,16 @@ class TestBuildinstallPhase(PungiTestCase): # Server.x86_64, Client.amd64, Server.x86_64 pool = poolCls.return_value self.assertEqual(3, len(pool.queue_put.mock_calls)) - self.assertItemsEqual( + six.assertCountEqual( + self, [call[0][0][3] for call in pool.queue_put.call_args_list], ['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir, 'rm -rf %s/work/amd64/buildinstall/Server && lorax ...' % self.topdir, 'rm -rf %s/work/x86_64/buildinstall/Server && lorax ...' % self.topdir]) # Obtained correct lorax commands. - self.assertItemsEqual( + six.assertCountEqual( + self, loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1.2.3', '1.2.3', [self.topdir + "/work/x86_64/repo/p1", @@ -318,7 +326,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')]) - self.assertItemsEqual( + six.assertCountEqual( + self, get_volid.mock_calls, [mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'), mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'), @@ -353,14 +362,16 @@ class TestBuildinstallPhase(PungiTestCase): # Server.x86_64, Client.amd64, Server.x86_64 pool = poolCls.return_value self.assertEqual(3, len(pool.queue_put.mock_calls)) - self.assertItemsEqual( + six.assertCountEqual( + self, [call[0][0][3] for call in pool.queue_put.call_args_list], ['rm -rf %s/work/amd64/buildinstall/Client && lorax ...' % self.topdir, 'rm -rf %s/work/amd64/buildinstall/Server && lorax ...' % self.topdir, 'rm -rf %s/work/x86_64/buildinstall/Server && lorax ...' % self.topdir]) # Obtained correct lorax commands. - self.assertItemsEqual( + six.assertCountEqual( + self, loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1', '1', [self.topdir + "/work/x86_64/repo/p1", @@ -395,7 +406,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], rootfs_size=None, log_dir=self.topdir + '/logs/amd64/buildinstall-Client-logs')]) - self.assertItemsEqual( + six.assertCountEqual( + self, get_volid.mock_calls, [mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'), mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'), @@ -430,14 +442,16 @@ class TestBuildinstallPhase(PungiTestCase): # Server.x86_64, Client.amd64, Server.x86_64 pool = poolCls.return_value self.assertEqual(3, len(pool.queue_put.mock_calls)) - self.assertItemsEqual( + six.assertCountEqual( + self, [call[0][0][3] for call in pool.queue_put.call_args_list], ['rm -rf %s/amd64/Client && lorax ...' % buildinstall_topdir, 'rm -rf %s/amd64/Server && lorax ...' % buildinstall_topdir, 'rm -rf %s/x86_64/Server && lorax ...' % buildinstall_topdir]) # Obtained correct lorax commands. - self.assertItemsEqual( + six.assertCountEqual( + self, loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1', '1', ["http://localhost/work/x86_64/repo/p1", @@ -472,7 +486,8 @@ class TestBuildinstallPhase(PungiTestCase): add_template_var=[], add_arch_template_var=[], rootfs_size=None, log_dir=buildinstall_topdir + '/amd64/Client/logs')]) - self.assertItemsEqual( + six.assertCountEqual( + self, get_volid.mock_calls, [mock.call(compose, 'x86_64', variant=compose.variants['Server'], disc_type='dvd'), mock.call(compose, 'amd64', variant=compose.variants['Client'], disc_type='dvd'), @@ -506,7 +521,8 @@ class TestBuildinstallPhase(PungiTestCase): phase.run() self.maxDiff = None - self.assertItemsEqual( + six.assertCountEqual( + self, loraxCls.return_value.get_lorax_cmd.mock_calls, [mock.call('Test', '1', '1', [self.topdir + "/work/x86_64/repo/p1", @@ -588,7 +604,7 @@ class BuildinstallThreadTestCase(PungiTestCase): t.process((compose, 'x86_64', compose.variants['Server'], self.cmd), 0) destdir = os.path.join(self.topdir, "work/x86_64/buildinstall/Server") - self.assertItemsEqual( + self.assertEqual( get_runroot_cmd.mock_calls, [mock.call( 'rrt', 'x86_64', self.cmd, channel=None, @@ -599,14 +615,14 @@ class BuildinstallThreadTestCase(PungiTestCase): os.path.join(self.topdir, "logs/x86_64/buildinstall-Server-logs"), ], )]) - self.assertItemsEqual( + self.assertEqual( run_runroot_cmd.mock_calls, [mock.call(get_runroot_cmd.return_value, log_file=self.topdir + '/logs/x86_64/buildinstall-Server.x86_64.log')]) with open(self.topdir + '/logs/x86_64/buildinstall-Server-RPMs.x86_64.log') as f: rpms = f.read().strip().split('\n') - self.assertItemsEqual(rpms, ['bash', 'zsh']) - self.assertItemsEqual(self.pool.finished_tasks, [('Server', 'x86_64')]) + six.assertCountEqual(self, rpms, ["bash", "zsh"]) + six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")]) self.assertEqual( mock_tweak.call_args_list, @@ -659,7 +675,7 @@ class BuildinstallThreadTestCase(PungiTestCase): t.process((compose, "amd64", None, self.cmd), 0) destdir = os.path.join(self.topdir, "work/amd64/buildinstall") - self.assertItemsEqual( + self.assertEqual( get_runroot_cmd.mock_calls, [mock.call( "rrt", "amd64", self.cmd, channel=None, @@ -667,15 +683,16 @@ class BuildinstallThreadTestCase(PungiTestCase): packages=['anaconda'], mounts=[self.topdir], weight=None, chown_paths=[destdir], )]) - self.assertItemsEqual( + self.assertEqual( run_runroot_cmd.mock_calls, [mock.call(get_runroot_cmd.return_value, log_file=self.topdir + "/logs/amd64/buildinstall.amd64.log")]) with open(self.topdir + "/logs/amd64/buildinstall-RPMs.amd64.log") as f: rpms = f.read().strip().split('\n') - self.assertItemsEqual(rpms, ['bash', 'zsh']) - self.assertItemsEqual(self.pool.finished_tasks, [(None, 'amd64')]) - self.assertItemsEqual( + six.assertCountEqual(self, rpms, ["bash", "zsh"]) + six.assertCountEqual(self, self.pool.finished_tasks, [(None, "amd64")]) + six.assertCountEqual( + self, mock_tweak.call_args_list, [ mock.call( @@ -691,7 +708,8 @@ class BuildinstallThreadTestCase(PungiTestCase): for var in ["Client", "Server"] ], ) - self.assertItemsEqual( + six.assertCountEqual( + self, mock_link.call_args_list, [ mock.call(compose, "amd64", compose.variants["Client"], False), @@ -731,7 +749,7 @@ class BuildinstallThreadTestCase(PungiTestCase): mock.call('Runroot task failed: 1234. See %s/logs/x86_64/buildinstall.x86_64.log for more details.' % self.topdir) ]) - self.assertItemsEqual(self.pool.finished_tasks, []) + self.assertEqual(self.pool.finished_tasks, set()) @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') @mock.patch('pungi.wrappers.kojiwrapper.get_buildroot_rpms') @@ -764,7 +782,7 @@ class BuildinstallThreadTestCase(PungiTestCase): mock.call('[FAIL] Buildinstall (variant Server, arch x86_64) failed, but going on anyway.'), mock.call('Runroot task failed: 1234. See %s/logs/x86_64/buildinstall-Server.x86_64.log for more details.' % self.topdir) ]) - self.assertItemsEqual(self.pool.finished_tasks, []) + self.assertEqual(self.pool.finished_tasks, set()) @mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper') @mock.patch('pungi.wrappers.kojiwrapper.get_buildroot_rpms') @@ -792,7 +810,7 @@ class BuildinstallThreadTestCase(PungiTestCase): self.assertEqual(0, len(run.mock_calls)) self.assertTrue(os.path.exists(dummy_file)) - self.assertItemsEqual(self.pool.finished_tasks, []) + self.assertEqual(self.pool.finished_tasks, set()) @mock.patch('pungi.phases.buildinstall.link_boot_iso') @mock.patch('pungi.phases.buildinstall.tweak_buildinstall') @@ -827,7 +845,7 @@ class BuildinstallThreadTestCase(PungiTestCase): with mock.patch('time.sleep'): t.process((compose, 'x86_64', compose.variants['Server'], self.cmd), 0) - self.assertItemsEqual( + self.assertEqual( get_runroot_cmd.mock_calls, [mock.call( 'rrt', 'x86_64', self.cmd, channel=None, @@ -838,18 +856,19 @@ class BuildinstallThreadTestCase(PungiTestCase): "/buildinstall_topdir/buildinstall-%s/x86_64/Server/logs" % os.path.basename(self.topdir), ], )]) - self.assertItemsEqual( + self.assertEqual( run_runroot_cmd.mock_calls, [mock.call(get_runroot_cmd.return_value, log_file=self.topdir + '/logs/x86_64/buildinstall-Server.x86_64.log')]) with open(self.topdir + '/logs/x86_64/buildinstall-Server-RPMs.x86_64.log') as f: rpms = f.read().strip().split('\n') - self.assertItemsEqual(rpms, ['bash', 'zsh']) - self.assertItemsEqual(self.pool.finished_tasks, [('Server', 'x86_64')]) + six.assertCountEqual(self, rpms, ["bash", "zsh"]) + six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")]) buildinstall_topdir = os.path.join( "/buildinstall_topdir", "buildinstall-" + os.path.basename(self.topdir)) - self.assertItemsEqual( + six.assertCountEqual( + self, copy_all.mock_calls, [mock.call(os.path.join(buildinstall_topdir, 'x86_64/Server/results'), os.path.join(self.topdir, 'work/x86_64/buildinstall/Server')), @@ -904,19 +923,22 @@ class TestSymlinkIso(PungiTestCase): self.assertEqual(os.stat(tgt).st_ino, os.stat(self.topdir + '/compose/Server/x86_64/os/images/boot.iso').st_ino) - self.assertItemsEqual( + self.assertEqual( self.compose.get_image_name.mock_calls, [mock.call('x86_64', self.compose.variants['Server'], disc_type='boot', disc_num=None, suffix='.iso')]) - self.assertItemsEqual(iso.get_implanted_md5.mock_calls, - [mock.call(tgt)]) - self.assertItemsEqual(iso.get_manifest_cmd.mock_calls, - [mock.call('image-name')]) - self.assertItemsEqual(iso.get_volume_id.mock_calls, - [mock.call(tgt)]) - self.assertItemsEqual(run.mock_calls, - [mock.call(iso.get_manifest_cmd.return_value, - workdir=self.topdir + '/compose/Server/x86_64/iso')]) + self.assertEqual(iso.get_implanted_md5.mock_calls, [mock.call(tgt)]) + self.assertEqual(iso.get_manifest_cmd.mock_calls, [mock.call("image-name")]) + self.assertEqual(iso.get_volume_id.mock_calls, [mock.call(tgt)]) + self.assertEqual( + run.mock_calls, + [ + mock.call( + iso.get_manifest_cmd.return_value, + workdir=self.topdir + "/compose/Server/x86_64/iso", + ), + ], + ) image = ImageCls.return_value self.assertEqual(image.path, 'Server/x86_64/iso/image-name') @@ -953,19 +975,22 @@ class TestSymlinkIso(PungiTestCase): self.assertEqual(os.stat(tgt).st_ino, os.stat(self.topdir + '/compose/Server/x86_64/os/images/boot.iso').st_ino) - self.assertItemsEqual( + self.assertEqual( self.compose.get_image_name.mock_calls, [mock.call('x86_64', self.compose.variants['Server'], disc_type='netinst', disc_num=None, suffix='.iso')]) - self.assertItemsEqual(iso.get_implanted_md5.mock_calls, - [mock.call(tgt)]) - self.assertItemsEqual(iso.get_manifest_cmd.mock_calls, - [mock.call('image-name')]) - self.assertItemsEqual(iso.get_volume_id.mock_calls, - [mock.call(tgt)]) - self.assertItemsEqual(run.mock_calls, - [mock.call(iso.get_manifest_cmd.return_value, - workdir=self.topdir + '/compose/Server/x86_64/iso')]) + self.assertEqual(iso.get_implanted_md5.mock_calls, [mock.call(tgt)]) + self.assertEqual(iso.get_manifest_cmd.mock_calls, [mock.call("image-name")]) + self.assertEqual(iso.get_volume_id.mock_calls, [mock.call(tgt)]) + self.assertEqual( + run.mock_calls, + [ + mock.call( + iso.get_manifest_cmd.return_value, + workdir=self.topdir + "/compose/Server/x86_64/iso", + ) + ], + ) image = ImageCls.return_value self.assertEqual(image.path, 'Server/x86_64/iso/image-name') diff --git a/tests/test_checks.py b/tests/test_checks.py index 147d0286..c301fdaa 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -573,19 +573,19 @@ class TestUmask(unittest.TestCase): os.umask(0o022) logger = mock.Mock() checks.check_umask(logger) - self.assertItemsEqual(logger.mock_calls, []) + self.assertEqual(logger.mock_calls, []) def test_no_warning_with_0000(self): os.umask(0o000) logger = mock.Mock() checks.check_umask(logger) - self.assertItemsEqual(logger.mock_calls, []) + self.assertEqual(logger.mock_calls, []) def test_warning_with_0044(self): os.umask(0o044) logger = mock.Mock() checks.check_umask(logger) - self.assertItemsEqual( + self.assertEqual( logger.mock_calls, [mock.call.warning('Unusually strict umask detected (0%03o), ' 'expect files with broken permissions.', 0o044)] diff --git a/tests/test_compose.py b/tests/test_compose.py index 234a9ce0..990f367e 100644 --- a/tests/test_compose.py +++ b/tests/test_compose.py @@ -6,6 +6,7 @@ try: except ImportError: import unittest import os +import six import sys import tempfile import shutil @@ -262,20 +263,25 @@ class ComposeTestCase(unittest.TestCase): ['Client', 'Crashy', 'Live', 'Server']) self.assertEqual(sorted(v.uid for v in compose.variants['Server'].variants.values()), ['Server-Gluster', 'Server-ResilientStorage', 'Server-optional']) - self.assertItemsEqual(compose.variants['Client'].arches, - ['i386', 'x86_64']) - self.assertItemsEqual(compose.variants['Crashy'].arches, - ['ppc64le']) - self.assertItemsEqual(compose.variants['Live'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Server'].arches, - ['s390x', 'x86_64']) - self.assertItemsEqual(compose.variants['Server'].variants['Gluster'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Server'].variants['ResilientStorage'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Server'].variants['optional'].arches, - ['s390x', 'x86_64']) + six.assertCountEqual( + self, compose.variants["Client"].arches, ["i386", "x86_64"] + ) + self.assertEqual(compose.variants["Crashy"].arches, ["ppc64le"]) + self.assertEqual(compose.variants["Live"].arches, ["x86_64"]) + six.assertCountEqual( + self, compose.variants["Server"].arches, ["s390x", "x86_64"] + ) + self.assertEqual( + compose.variants["Server"].variants["Gluster"].arches, ["x86_64"] + ) + self.assertEqual( + compose.variants["Server"].variants["ResilientStorage"].arches, ["x86_64"] + ) + six.assertCountEqual( + self, + compose.variants["Server"].variants["optional"].arches, + ["s390x", "x86_64"] + ) self.assertEqual([v.uid for v in compose.get_variants()], ['Client', 'Crashy', 'Live', 'Server', 'Server-Gluster', @@ -305,18 +311,18 @@ class ComposeTestCase(unittest.TestCase): ['Client', 'Live', 'Server']) self.assertEqual(sorted(v.uid for v in compose.variants['Server'].variants.values()), ['Server-Gluster', 'Server-ResilientStorage', 'Server-optional']) - self.assertItemsEqual(compose.variants['Client'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Live'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Server'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Server'].variants['Gluster'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Server'].variants['ResilientStorage'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Server'].variants['optional'].arches, - ['x86_64']) + self.assertEqual(compose.variants["Client"].arches, ["x86_64"]) + self.assertEqual(compose.variants["Live"].arches, ["x86_64"]) + self.assertEqual(compose.variants["Server"].arches, ["x86_64"]) + self.assertEqual( + compose.variants["Server"].variants["Gluster"].arches, ["x86_64"] + ) + self.assertEqual( + compose.variants["Server"].variants["ResilientStorage"].arches, ["x86_64"] + ) + self.assertEqual( + compose.variants["Server"].variants["optional"].arches, ["x86_64"] + ) self.assertEqual(compose.get_arches(), ['x86_64']) self.assertEqual([v.uid for v in compose.get_variants()], @@ -348,12 +354,15 @@ class ComposeTestCase(unittest.TestCase): self.assertEqual(sorted(v.uid for v in compose.variants.values()), ['Client', 'Server']) - self.assertItemsEqual(compose.variants['Client'].arches, - ['i386', 'x86_64']) - self.assertItemsEqual(compose.variants['Server'].arches, - ['s390x', 'x86_64']) - self.assertItemsEqual(compose.variants['Server'].variants['Gluster'].arches, - ['x86_64']) + six.assertCountEqual( + self, compose.variants["Client"].arches, ["i386", "x86_64"] + ) + six.assertCountEqual( + self, compose.variants["Server"].arches, ["s390x", "x86_64"] + ) + self.assertEqual( + compose.variants["Server"].variants["Gluster"].arches, ["x86_64"] + ) self.assertEqual(compose.get_arches(), ['i386', 's390x', 'x86_64']) self.assertEqual([v.uid for v in compose.get_variants()], @@ -388,18 +397,18 @@ class ComposeTestCase(unittest.TestCase): self.assertEqual(sorted(v.uid for v in compose.variants.values()), ['Client', 'Server']) - self.assertItemsEqual(compose.variants['Client'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Server'].arches, - ['x86_64']) - self.assertItemsEqual(compose.variants['Server'].variants['optional'].arches, - ['x86_64']) + self.assertEqual(compose.variants["Client"].arches, ["x86_64"]) + self.assertEqual(compose.variants["Server"].arches, ["x86_64"]) + self.assertEqual( + compose.variants["Server"].variants["optional"].arches, ["x86_64"] + ) self.assertEqual(compose.get_arches(), ['x86_64']) self.assertEqual([v.uid for v in compose.get_variants()], ['Client', 'Server', 'Server-optional']) - self.assertItemsEqual( + six.assertCountEqual( + self, logger.info.call_args_list, [mock.call('Excluding variant Live: filtered by configuration.'), mock.call('Excluding variant Crashy: all its arches are filtered.'), diff --git a/tests/test_config.py b/tests/test_config.py index f6c57f2f..ddbe2940 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -20,7 +20,7 @@ from tests.helpers import load_config, PKGSET_REPOS class ConfigTestCase(unittest.TestCase): def assertValidation(self, cfg, errors=[], warnings=[]): actual_errors, actual_warnings = checks.validate(cfg) - self.assertItemsEqual(errors, actual_errors) + six.assertCountEqual(self, errors, actual_errors) self.assertEqual(warnings, actual_warnings) diff --git a/tests/test_createiso_phase.py b/tests/test_createiso_phase.py index ef836929..f1a98a4a 100644 --- a/tests/test_createiso_phase.py +++ b/tests/test_createiso_phase.py @@ -2,6 +2,7 @@ import mock +import six import os import sys @@ -49,7 +50,8 @@ class CreateisoPhaseTest(helpers.PungiTestCase): self.assertEqual(len(pool.add.call_args_list), 0) self.assertEqual(pool.queue_put.call_args_list, []) - self.assertItemsEqual( + six.assertCountEqual( + self, phase.logger.warn.call_args_list, [mock.call('No RPMs found for Everything.x86_64, skipping ISO'), mock.call('No RPMs found for Everything.amd64, skipping ISO'), @@ -92,7 +94,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase): [mock.call(compose, 'x86_64', compose.variants['Server'], no_split=False, logger=phase.logger)]) self.assertEqual(len(pool.add.call_args_list), 1) self.maxDiff = None - self.assertItemsEqual( + self.assertEqual( [x[0][0] for x in write_script.call_args_list], [CreateIsoOpts( output_dir='%s/compose/Server/x86_64/iso' % self.topdir, @@ -105,7 +107,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase): os_tree='%s/compose/Server/x86_64/os' % self.topdir, hfs_compat=True, )]) - self.assertItemsEqual( + self.assertEqual( pool.queue_put.call_args_list, [mock.call(( compose, @@ -150,19 +152,22 @@ class CreateisoPhaseTest(helpers.PungiTestCase): phase.logger = mock.Mock() phase.run() - self.assertItemsEqual( + six.assertCountEqual( + self, prepare_iso.call_args_list, [mock.call(compose, 'x86_64', compose.variants['Server'], disc_count=1, disc_num=1, split_iso_data=disc_data), mock.call(compose, 'src', compose.variants['Server'], disc_count=1, disc_num=1, split_iso_data=disc_data)]) - self.assertItemsEqual( + six.assertCountEqual( + self, split_iso.call_args_list, [mock.call(compose, 'x86_64', compose.variants['Server'], no_split=True, logger=phase.logger), mock.call(compose, 'src', compose.variants['Server'], no_split=False, logger=phase.logger)]) self.assertEqual(len(pool.add.call_args_list), 2) self.maxDiff = None - self.assertItemsEqual( + six.assertCountEqual( + self, [x[0][0] for x in write_script.call_args_list], [CreateIsoOpts(output_dir='%s/compose/Server/x86_64/iso' % self.topdir, iso_name='image-name', @@ -183,7 +188,8 @@ class CreateisoPhaseTest(helpers.PungiTestCase): jigdo_dir='%s/compose/Server/source/jigdo' % self.topdir, os_tree='%s/compose/Server/source/tree' % self.topdir, hfs_compat=True)]) - self.assertItemsEqual( + six.assertCountEqual( + self, pool.queue_put.call_args_list, [mock.call((compose, {'iso_path': '%s/compose/Server/x86_64/iso/image-name' % self.topdir, @@ -235,16 +241,16 @@ class CreateisoPhaseTest(helpers.PungiTestCase): phase.logger = mock.Mock() phase.run() - self.assertItemsEqual( + self.assertEqual( prepare_iso.call_args_list, [mock.call(compose, 'src', compose.variants['Server'], disc_count=1, disc_num=1, split_iso_data=disc_data)]) - self.assertItemsEqual( + self.assertEqual( split_iso.call_args_list, [mock.call(compose, 'src', compose.variants['Server'], no_split=False, logger=phase.logger)]) self.assertEqual(len(pool.add.call_args_list), 1) self.maxDiff = None - self.assertItemsEqual( + self.assertEqual( [x[0][0] for x in write_script.call_args_list], [CreateIsoOpts(output_dir='%s/compose/Server/source/iso' % self.topdir, iso_name='image-name', @@ -255,7 +261,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase): jigdo_dir='%s/compose/Server/source/jigdo' % self.topdir, os_tree='%s/compose/Server/source/tree' % self.topdir, hfs_compat=True)]) - self.assertItemsEqual( + self.assertEqual( pool.queue_put.call_args_list, [mock.call((compose, {'iso_path': '%s/compose/Server/source/iso/image-name' % self.topdir, @@ -300,15 +306,15 @@ class CreateisoPhaseTest(helpers.PungiTestCase): phase.run() self.maxDiff = None - self.assertItemsEqual( + self.assertEqual( prepare_iso.call_args_list, [mock.call(compose, 'x86_64', compose.variants['Server'], disc_count=1, disc_num=1, split_iso_data=disc_data)]) - self.assertItemsEqual( + self.assertEqual( split_iso.call_args_list, [mock.call(compose, 'x86_64', compose.variants['Server'], no_split=False, logger=phase.logger)]) self.assertEqual(len(pool.add.call_args_list), 1) - self.assertItemsEqual( + self.assertEqual( [x[0][0] for x in write_script.call_args_list], [CreateIsoOpts(output_dir='%s/compose/Server/x86_64/iso' % self.topdir, iso_name='image-name', @@ -319,7 +325,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase): jigdo_dir='%s/compose/Server/x86_64/jigdo' % self.topdir, os_tree='%s/compose/Server/x86_64/os' % self.topdir, hfs_compat=False)]) - self.assertItemsEqual( + self.assertEqual( pool.queue_put.call_args_list, [mock.call((compose, {'iso_path': '%s/compose/Server/x86_64/iso/image-name' % self.topdir, diff --git a/tests/test_createrepo_wrapper.py b/tests/test_createrepo_wrapper.py index 67727e84..96cfc577 100644 --- a/tests/test_createrepo_wrapper.py +++ b/tests/test_createrepo_wrapper.py @@ -5,6 +5,8 @@ try: except ImportError: import unittest +import six + import os import sys @@ -20,7 +22,9 @@ class CreateRepoWrapperTest(unittest.TestCase): cmd = repo.get_createrepo_cmd('/test/dir') self.assertEqual(cmd[:2], ['createrepo_c', '/test/dir']) - self.assertItemsEqual(cmd[2:], ['--update', '--database', '--unique-md-filenames']) + six.assertCountEqual( + self, cmd[2:], ["--update", "--database", "--unique-md-filenames"] + ) def test_get_createrepo_c_cmd_full(self): repo = CreaterepoWrapper() @@ -37,22 +41,28 @@ class CreateRepoWrapperTest(unittest.TestCase): self.maxDiff = None self.assertEqual(cmd[:2], ['createrepo_c', '/test/dir']) - self.assertItemsEqual(cmd[2:], - ['--baseurl=http://base.example.com', '--excludes=abc', '--excludes=xyz', - '--pkglist=/test/pkglist', '--groupfile=/test/comps', '--cachedir=/test/cache', - '--skip-stat', '--update-md-path=/test/md_path', '--split', '--checkts', - '--checksum=sha256', '--distro=Fedora', '--simple-md-filenames', '--no-database', - '--content=c1', '--content=c2', '--repo=r1', '--repo=r2', '--revision=rev', - '--deltas', '--oldpackagedirs=/test/old', '--num-deltas=2', '--workers=3', - '--outputdir=/test/output', '--xz', "--zck", "--zck-primary-dict=/foo/bar"]) + six.assertCountEqual( + self, + cmd[2:], + ["--baseurl=http://base.example.com", "--excludes=abc", "--excludes=xyz", + "--pkglist=/test/pkglist", "--groupfile=/test/comps", "--cachedir=/test/cache", + "--skip-stat", "--update-md-path=/test/md_path", "--split", "--checkts", + "--checksum=sha256", "--distro=Fedora", "--simple-md-filenames", "--no-database", + "--content=c1", "--content=c2", "--repo=r1", "--repo=r2", "--revision=rev", + "--deltas", "--oldpackagedirs=/test/old", "--num-deltas=2", "--workers=3", + "--outputdir=/test/output", "--xz", "--zck", "--zck-primary-dict=/foo/bar"], + ) def test_get_createrepo_cmd_minimal(self): repo = CreaterepoWrapper(False) cmd = repo.get_createrepo_cmd('/test/dir') self.assertEqual(cmd[:2], ['createrepo', '/test/dir']) - self.assertItemsEqual(cmd[2:], ['--update', '--database', '--unique-md-filenames', - '--pretty']) + six.assertCountEqual( + self, + cmd[2:], + ["--update", "--database", "--unique-md-filenames", "--pretty"], + ) def test_get_createrepo_cmd_full(self): repo = CreaterepoWrapper(False) @@ -67,11 +77,14 @@ class CreateRepoWrapperTest(unittest.TestCase): self.maxDiff = None self.assertEqual(cmd[:2], ['createrepo', '/test/dir']) - self.assertItemsEqual(cmd[2:], - ['--baseurl=http://base.example.com', '--excludes=abc', '--excludes=xyz', - '--pkglist=/test/pkglist', '--groupfile=/test/comps', '--cachedir=/test/cache', - '--skip-stat', '--update-md-path=/test/md_path', '--split', '--checkts', - '--checksum=sha256', '--distro=Fedora', '--simple-md-filenames', '--no-database', - '--content=c1', '--content=c2', '--repo=r1', '--repo=r2', '--revision=rev', - '--deltas', '--oldpackagedirs=/test/old', '--num-deltas=2', '--workers=3', - '--outputdir=/test/output']) + six.assertCountEqual( + self, + cmd[2:], + ["--baseurl=http://base.example.com", "--excludes=abc", "--excludes=xyz", + "--pkglist=/test/pkglist", "--groupfile=/test/comps", "--cachedir=/test/cache", + "--skip-stat", "--update-md-path=/test/md_path", "--split", "--checkts", + "--checksum=sha256", "--distro=Fedora", "--simple-md-filenames", "--no-database", + "--content=c1", "--content=c2", "--repo=r1", "--repo=r2", "--revision=rev", + "--deltas", "--oldpackagedirs=/test/old", "--num-deltas=2", "--workers=3", + "--outputdir=/test/output"], + ) diff --git a/tests/test_createrepophase.py b/tests/test_createrepophase.py index 520f8214..53406e95 100644 --- a/tests/test_createrepophase.py +++ b/tests/test_createrepophase.py @@ -9,6 +9,7 @@ import mock import glob import os +import six import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) @@ -75,7 +76,8 @@ class TestCreaterepoPhase(PungiTestCase): everything = compose.variants["Everything"] client = compose.variants["Client"] self.assertEqual(len(pool.add.mock_calls), 5) - self.assertItemsEqual( + six.assertCountEqual( + self, pool.queue_put.mock_calls, [ mock.call((compose, "x86_64", server, "rpm")), @@ -110,7 +112,8 @@ class TestCreaterepoPhase(PungiTestCase): server = compose.variants["Server"] everything = compose.variants["Everything"] self.assertEqual(len(pool.add.mock_calls), 5) - self.assertItemsEqual( + six.assertCountEqual( + self, pool.queue_put.mock_calls, [ mock.call((compose, "x86_64", server, "rpm")), @@ -139,8 +142,10 @@ def make_mocked_modifyrepo_cmd(tc, module_artifacts): tc.assertEqual(len(module_streams), len(module_artifacts)) for ms in module_streams: tc.assertIn(ms.get_stream_name(), module_artifacts) - tc.assertItemsEqual( - ms.get_rpm_artifacts(), module_artifacts[ms.get_stream_name()], + six.assertCountEqual( + tc, + ms.get_rpm_artifacts(), + module_artifacts[ms.get_stream_name()], ) return mocked_modifyrepo_cmd @@ -171,7 +176,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -179,9 +184,7 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -204,7 +207,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=False, groupfile=None, workers=3, @@ -212,9 +215,7 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -236,7 +237,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/global/repo_package_list/Server.None.srpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/source/tree', checksum='sha256', database=True, groupfile=None, workers=3, @@ -244,13 +245,9 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/global", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: - self.assertItemsEqual( - f.read().strip().split('\n'), - ['Packages/b/bash-4.3.30-2.fc21.src.rpm']) + self.assertEqual(f.read(), "Packages/b/bash-4.3.30-2.fc21.src.rpm\n") @mock.patch('pungi.phases.createrepo.run') @mock.patch('pungi.phases.createrepo.CreaterepoWrapper') @@ -271,7 +268,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.debuginfo.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/debug/tree', checksum='sha256', database=True, groupfile=None, workers=3, @@ -279,9 +276,7 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-debuginfo-4.3.30-2.fc21.x86_64.rpm\n') @@ -304,7 +299,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=False)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -312,9 +307,7 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -341,7 +334,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=10, @@ -349,9 +342,7 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -374,7 +365,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -382,9 +373,7 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=True, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -409,7 +398,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -418,9 +407,7 @@ class TestCreateVariantRepo(PungiTestCase): update_md_path=None, deltas=True, oldpackagedirs=self.topdir + '/old/test-1.0-20151203.0/compose/Server/x86_64/os/Packages', use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -445,7 +432,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -454,9 +441,7 @@ class TestCreateVariantRepo(PungiTestCase): update_md_path=None, deltas=True, oldpackagedirs=self.topdir + '/old/test-1.0-20151203.0/compose/Server/x86_64/os/Packages', use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -481,7 +466,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -489,9 +474,7 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -517,7 +500,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -525,9 +508,7 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -557,7 +538,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -569,9 +550,7 @@ class TestCreateVariantRepo(PungiTestCase): self.topdir + '/old/test-1.0-20151203.0/compose/Server/x86_64/os/Packages/b', ], use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -598,7 +577,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -607,9 +586,7 @@ class TestCreateVariantRepo(PungiTestCase): update_md_path="/repo/x86_64", deltas=True, oldpackagedirs=[], use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -635,7 +612,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/global/repo_package_list/Server.None.srpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/source/tree', checksum='sha256', database=True, groupfile=None, workers=3, @@ -643,13 +620,9 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/global", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: - self.assertItemsEqual( - f.read().strip().split('\n'), - ['Packages/b/bash-4.3.30-2.fc21.src.rpm']) + self.assertEqual(f.read(), "Packages/b/bash-4.3.30-2.fc21.src.rpm\n") @mock.patch('pungi.phases.createrepo.run') @mock.patch('pungi.phases.createrepo.CreaterepoWrapper') @@ -673,7 +646,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.debuginfo.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/debug/tree', checksum='sha256', database=True, groupfile=None, workers=3, @@ -681,9 +654,7 @@ class TestCreateVariantRepo(PungiTestCase): pkglist=list_file, skip_stat=True, update=True, update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( - repo.get_modifyrepo_cmd.mock_calls, - []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-debuginfo-4.3.30-2.fc21.x86_64.rpm\n') @@ -713,7 +684,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.rpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/os', checksum='sha256', database=True, groupfile=None, workers=3, @@ -722,9 +693,10 @@ class TestCreateVariantRepo(PungiTestCase): update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual( + self.assertEqual( repo.get_modifyrepo_cmd.mock_calls, - [mock.call(repodata_dir, product_id, compress_type='gz')]) + [mock.call(repodata_dir, product_id, compress_type="gz")] + ) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.x86_64.rpm\n') @@ -748,7 +720,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/x86_64/repo_package_list/Server.x86_64.debuginfo.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/x86_64/debug/tree', checksum='sha256', database=True, groupfile=None, workers=3, @@ -757,7 +729,7 @@ class TestCreateVariantRepo(PungiTestCase): update_md_path="/repo/x86_64", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual(repo.get_modifyrepo_cmd.mock_calls, []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-debuginfo-4.3.30-2.fc21.x86_64.rpm\n') @@ -781,7 +753,7 @@ class TestCreateVariantRepo(PungiTestCase): list_file = self.topdir + '/work/global/repo_package_list/Server.None.srpm.conf' self.assertEqual(CreaterepoWrapperCls.mock_calls[0], mock.call(createrepo_c=True)) - self.assertItemsEqual( + self.assertEqual( repo.get_createrepo_cmd.mock_calls, [mock.call(self.topdir + '/compose/Server/source/tree', checksum='sha256', database=True, groupfile=None, workers=3, @@ -790,7 +762,7 @@ class TestCreateVariantRepo(PungiTestCase): update_md_path="/repo/global", deltas=False, oldpackagedirs=None, use_xz=False, extra_args=[])]) - self.assertItemsEqual(repo.get_modifyrepo_cmd.mock_calls, []) + self.assertEqual(repo.get_modifyrepo_cmd.mock_calls, []) with open(list_file) as f: self.assertEqual(f.read(), 'Packages/b/bash-4.3.30-2.fc21.src.rpm\n') @@ -829,9 +801,10 @@ class TestCreateVariantRepo(PungiTestCase): compose, "x86_64", compose.variants["Server"], "rpm", self.pkgset, modules_metadata ) - self.assertItemsEqual( + self.assertEqual( repo.get_modifyrepo_cmd.mock_calls, - [mock.call(repodata_dir, ANY, compress_type='gz', mdtype='modules')]) + [mock.call(repodata_dir, ANY, compress_type="gz", mdtype="modules")], + ) @unittest.skipUnless(Modulemd is not None, 'Skipped test, no module support.') @mock.patch('pungi.phases.createrepo.find_file_in_repodata') @@ -881,9 +854,10 @@ class TestCreateVariantRepo(PungiTestCase): compose, "x86_64", compose.variants["Server"], "rpm", self.pkgset, modules_metadata ) - self.assertItemsEqual( + self.assertEqual( repo.get_modifyrepo_cmd.mock_calls, - [mock.call(repodata_dir, ANY, compress_type='gz', mdtype='modules')]) + [mock.call(repodata_dir, ANY, compress_type="gz", mdtype="modules")], + ) class ANYSingleton(object): @@ -914,7 +888,7 @@ class TestGetProductIds(PungiTestCase): 'product_id', '%s.%s.pem' % (variant, arch), 'productid')) - self.assertItemsEqual(pids, expected) + six.assertCountEqual(self, pids, expected) @mock.patch('pungi.phases.createrepo.get_dir_from_scm') def test_not_configured(self, get_dir_from_scm): diff --git a/tests/test_extra_files_phase.py b/tests/test_extra_files_phase.py index 053ce17b..d897970d 100644 --- a/tests/test_extra_files_phase.py +++ b/tests/test_extra_files_phase.py @@ -4,6 +4,8 @@ import mock import os import sys +import six + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases import extra_files @@ -33,7 +35,8 @@ class TestExtraFilePhase(helpers.PungiTestCase): phase = extra_files.ExtraFilesPhase(compose, pkgset_phase) phase.run() - self.assertItemsEqual( + six.assertCountEqual( + self, copy_extra_files.call_args_list, [mock.call(compose, [cfg], 'x86_64', compose.variants['Server'], pkgset_phase.package_sets), diff --git a/tests/test_extra_isos_phase.py b/tests/test_extra_isos_phase.py index e63490c3..9dc01ae3 100644 --- a/tests/test_extra_isos_phase.py +++ b/tests/test_extra_isos_phase.py @@ -2,6 +2,7 @@ import mock +import six import os import sys @@ -45,7 +46,8 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase): phase.run() self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 3) - self.assertItemsEqual( + six.assertCountEqual( + self, ThreadPool.return_value.queue_put.call_args_list, [mock.call((compose, cfg, compose.variants['Server'], 'x86_64')), mock.call((compose, cfg, compose.variants['Server'], 'amd64')), @@ -67,7 +69,8 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase): phase.run() self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2) - self.assertItemsEqual( + six.assertCountEqual( + self, ThreadPool.return_value.queue_put.call_args_list, [mock.call((compose, cfg, compose.variants['Server'], 'x86_64')), mock.call((compose, cfg, compose.variants['Server'], 'src'))] @@ -88,7 +91,8 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase): phase.run() self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2) - self.assertItemsEqual( + six.assertCountEqual( + self, ThreadPool.return_value.queue_put.call_args_list, [mock.call((compose, cfg, compose.variants['Server'], 'x86_64')), mock.call((compose, cfg, compose.variants['Server'], 'amd64'))] @@ -582,7 +586,8 @@ class GetIsoContentsTest(helpers.PungiTestCase): 'Server/repodata/repomd.xml': '/mnt/repodata/repomd.xml', } - self.assertItemsEqual( + six.assertCountEqual( + self, ggp.call_args_list, [mock.call([os.path.join(self.topdir, x)]) for x in gp] ) @@ -644,7 +649,8 @@ class GetIsoContentsTest(helpers.PungiTestCase): "Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml", } - self.assertItemsEqual( + six.assertCountEqual( + self, ggp.call_args_list, [mock.call([os.path.join(self.topdir, x)]) for x in gp] ) @@ -702,7 +708,8 @@ class GetIsoContentsTest(helpers.PungiTestCase): 'Server/repodata/repomd.xml': '/mnt/repodata/repomd.xml', } - self.assertItemsEqual( + six.assertCountEqual( + self, ggp.call_args_list, [mock.call([os.path.join(self.topdir, x)]) for x in gp] ) @@ -780,7 +787,8 @@ class GetIsoContentsTest(helpers.PungiTestCase): ), } - self.assertItemsEqual( + six.assertCountEqual( + self, ggp.call_args_list, [mock.call([os.path.join(self.topdir, x)]) for x in gp] + [mock.call([bi_dir, iso_dir])] ) diff --git a/tests/test_fus_wrapper.py b/tests/test_fus_wrapper.py index 64e369d1..1d2dcf8c 100644 --- a/tests/test_fus_wrapper.py +++ b/tests/test_fus_wrapper.py @@ -7,6 +7,8 @@ except ImportError: import tempfile from textwrap import dedent +import six + import os import sys @@ -132,29 +134,30 @@ class TestParseOutput(unittest.TestCase): def test_skips_debug_line(self): touch(self.file, "debug line\n") packages, modules = fus.parse_output(self.file) - self.assertItemsEqual(packages, []) - self.assertItemsEqual(modules, []) + self.assertEqual(packages, set()) + self.assertEqual(modules, set()) def test_separates_arch(self): touch(self.file, "pkg-1.0-1.x86_64@repo-0\npkg-1.0-1.i686@repo-0\n") packages, modules = fus.parse_output(self.file) - self.assertItemsEqual( + six.assertCountEqual( + self, packages, [("pkg-1.0-1", "x86_64", frozenset()), ("pkg-1.0-1", "i686", frozenset())], ) - self.assertItemsEqual(modules, []) + self.assertEqual(modules, set()) def test_marks_modular(self): touch(self.file, "*pkg-1.0-1.x86_64@repo-0\n") packages, modules = fus.parse_output(self.file) - self.assertItemsEqual( + self.assertEqual( packages, - [("pkg-1.0-1", "x86_64", frozenset(["modular"]))], + set([("pkg-1.0-1", "x86_64", frozenset(["modular"]))]), ) - self.assertItemsEqual(modules, []) + self.assertEqual(modules, set()) def test_extracts_modules(self): touch(self.file, "module:mod:master:20181003:cafebeef.x86_64@repo-0\n") packages, modules = fus.parse_output(self.file) - self.assertItemsEqual(packages, []) - self.assertItemsEqual(modules, ["mod:master:20181003:cafebeef"]) + self.assertEqual(packages, set()) + self.assertEqual(modules, set(["mod:master:20181003:cafebeef"])) diff --git a/tests/test_gather.py b/tests/test_gather.py index 4d9ac411..f4cfaf7f 100644 --- a/tests/test_gather.py +++ b/tests/test_gather.py @@ -65,13 +65,9 @@ class DepsolvingBase(object): self.assertNotIn("dummy-kernel-3.1.0-1.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-kernel-3.1.0-1.x86_64.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-kernel-3.1.0-1.src.rpm" - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + self.assertEqual(pkg_map["rpm"], ["dummy-kernel-3.1.0-1.x86_64.rpm"]) + self.assertEqual(pkg_map["srpm"], ["dummy-kernel-3.1.0-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_kernel_fulltree(self): packages = [ @@ -81,15 +77,17 @@ class DepsolvingBase(object): self.assertNotIn("dummy-kernel-3.1.0-1.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-kernel-3.1.0-1.x86_64.rpm", # Important - "dummy-kernel-headers-3.1.0-1.x86_64.rpm", - "dummy-kernel-doc-3.1.0-1.noarch.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-kernel-3.1.0-1.src.rpm" - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-kernel-3.1.0-1.x86_64.rpm", # Important + "dummy-kernel-headers-3.1.0-1.x86_64.rpm", + "dummy-kernel-doc-3.1.0-1.noarch.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-kernel-3.1.0-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_kernel_fulltree_excludes(self): packages = [ @@ -100,13 +98,9 @@ class DepsolvingBase(object): self.assertNotIn("dummy-kernel-3.1.0-1.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-kernel-3.1.0-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-kernel-3.1.0-1.src.rpm" - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + self.assertEqual(pkg_map["rpm"], ["dummy-kernel-3.1.0-1.x86_64.rpm"]) + self.assertEqual(pkg_map["srpm"], ["dummy-kernel-3.1.0-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_kernel_doc_fulltree(self): packages = [ @@ -116,15 +110,17 @@ class DepsolvingBase(object): self.assertNotIn("dummy-kernel-3.1.0-1.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-kernel-3.1.0-1.x86_64.rpm", # Important - "dummy-kernel-headers-3.1.0-1.x86_64.rpm", - "dummy-kernel-doc-3.1.0-1.noarch.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-kernel-3.1.0-1.src.rpm" - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-kernel-3.1.0-1.x86_64.rpm", # Important + "dummy-kernel-headers-3.1.0-1.x86_64.rpm", + "dummy-kernel-doc-3.1.0-1.noarch.rpm", # Important + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-kernel-3.1.0-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_bash_noarch_pulls_64bit(self): packages = [ @@ -135,29 +131,41 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.ppc.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.ppc64.rpm", # Important - "dummy-bash-doc-4.2.37-6.noarch.rpm", # Important - "dummy-filesystem-4.2.37-6.ppc64.rpm", - "dummy-glibc-2.14-5.ppc.rpm", - "dummy-glibc-2.14-5.ppc64.rpm", - "dummy-glibc-common-2.14-5.ppc64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.ppc64.rpm", - "dummy-bash-debugsource-4.2.37-6.ppc64.rpm", - "dummy-glibc-debuginfo-2.14-5.ppc.rpm", - "dummy-glibc-debuginfo-2.14-5.ppc64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.ppc.rpm", - "dummy-glibc-debuginfo-common-2.14-5.ppc64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.ppc64.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.rpm", # Important + "dummy-filesystem-4.2.37-6.ppc64.rpm", + "dummy-glibc-2.14-5.ppc.rpm", + "dummy-glibc-2.14-5.ppc64.rpm", + "dummy-glibc-common-2.14-5.ppc64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.ppc64.rpm", + "dummy-bash-debugsource-4.2.37-6.ppc64.rpm", + "dummy-glibc-debuginfo-2.14-5.ppc.rpm", + "dummy-glibc-debuginfo-2.14-5.ppc64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.ppc.rpm", + "dummy-glibc-debuginfo-common-2.14-5.ppc64.rpm", + ], + ) def test_foo32_doc_fulltree(self): packages = [ @@ -165,14 +173,16 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none", fulltree=True) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-foo32-1-1.i686.rpm", # Important - "dummy-foo32-doc-1-1.noarch.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-foo32-1-1.src.rpm" - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-foo32-1-1.i686.rpm", # Important + "dummy-foo32-doc-1-1.noarch.rpm", # Important + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-foo32-1-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_bash_exclude_debuginfo(self): packages = [ @@ -182,23 +192,35 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.x86_64.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.x86_64.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_bash_multilib_exclude_debuginfo(self): packages = [ @@ -208,25 +230,37 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_bash(self): packages = [ @@ -238,25 +272,37 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-5.x86_64.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.x86_64.rpm", # Important - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", - "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_bash_s390x(self): packages = [ @@ -268,25 +314,37 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-5.s390x.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-bash-4.2.37-6.s390.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.s390x.rpm", # Important - "dummy-filesystem-4.2.37-6.s390x.rpm", - "dummy-glibc-2.14-5.s390x.rpm", - "dummy-glibc-common-2.14-5.s390x.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.s390x.rpm", - "dummy-bash-debugsource-4.2.37-6.s390x.rpm", - "dummy-glibc-debuginfo-2.14-5.s390x.rpm", - "dummy-glibc-debuginfo-common-2.14-5.s390x.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.s390x.rpm", # Important + "dummy-filesystem-4.2.37-6.s390x.rpm", + "dummy-glibc-2.14-5.s390x.rpm", + "dummy-glibc-common-2.14-5.s390x.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.s390x.rpm", + "dummy-bash-debugsource-4.2.37-6.s390x.rpm", + "dummy-glibc-debuginfo-2.14-5.s390x.rpm", + "dummy-glibc-debuginfo-common-2.14-5.s390x.rpm", + ], + ) def test_bash_greedy(self): # we want only the latest package version @@ -298,33 +356,45 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-5.i686.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-bash-4.2.37-5.x86_64.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", # Important - "dummy-bash-4.2.37-6.x86_64.rpm", # Important - "dummy-filesystem-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.i686.rpm", - "dummy-bash-debugsource-4.2.37-6.i686.rpm", - "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", - "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "dummy-filesystem-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.i686.rpm", + "dummy-bash-debugsource-4.2.37-6.i686.rpm", + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_bash_older(self): packages = [ @@ -336,24 +406,36 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-5.x86_64.rpm", # Important - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-5.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-5.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-5.x86_64.rpm", # Important + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-5.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-5.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_system_release(self): packages = [ @@ -370,13 +452,9 @@ class DepsolvingBase(object): self.assertNotIn("dummy-release-server-1.0.0-1.x86_64.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-release-notes-1.2-1.noarch.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-filesystem-4.2.37-6.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-filesystem-4.2.37-6.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + self.assertEqual(pkg_map["rpm"], ["dummy-filesystem-4.2.37-6.x86_64.rpm"]) + self.assertEqual(pkg_map["srpm"], ["dummy-filesystem-4.2.37-6.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_system_release_greedy(self): packages = [ @@ -386,20 +464,28 @@ class DepsolvingBase(object): self.assertNotIn("dummy-release-notes-1.2-1.noarch.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-release-client-1.0.0-1.i686.rpm", # Important - "dummy-release-client-1.0.0-1.x86_64.rpm", # Important - "dummy-release-client-workstation-1.0.0-1.i686.rpm", # Important - "dummy-release-client-workstation-1.0.0-1.x86_64.rpm", # Important - "dummy-release-server-1.0.0-1.i686.rpm", # Important - "dummy-release-server-1.0.0-1.x86_64.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-release-client-1.0.0-1.src.rpm", - "dummy-release-client-workstation-1.0.0-1.src.rpm", - "dummy-release-server-1.0.0-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-release-client-1.0.0-1.i686.rpm", # Important + "dummy-release-client-1.0.0-1.x86_64.rpm", # Important + "dummy-release-client-workstation-1.0.0-1.i686.rpm", # Important + "dummy-release-client-workstation-1.0.0-1.x86_64.rpm", # Important + "dummy-release-server-1.0.0-1.i686.rpm", # Important + "dummy-release-server-1.0.0-1.x86_64.rpm", # Important + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-release-client-1.0.0-1.src.rpm", + "dummy-release-client-workstation-1.0.0-1.src.rpm", + "dummy-release-server-1.0.0-1.src.rpm", + ], + ) + self.assertEqual(pkg_map["debuginfo"], []) def test_smtpdaemon(self): packages = [ @@ -411,27 +497,39 @@ class DepsolvingBase(object): self.assertNotIn("dummy-sendmail-8.14.5-12.i686.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-sendmail-8.14.5-12.x86_64.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-postfix-2.9.2-2.x86_64.rpm", # Important - "dummy-vacation-1.2.7.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-postfix-2.9.2-2.src.rpm", - "dummy-vacation-1.2.7.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm", - "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-postfix-2.9.2-2.x86_64.rpm", # Important + "dummy-vacation-1.2.7.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-postfix-2.9.2-2.src.rpm", + "dummy-vacation-1.2.7.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", + ], + ) def test_smtpdaemon_sendmail(self): packages = [ @@ -444,27 +542,39 @@ class DepsolvingBase(object): self.assertNotIn("dummy-postfix-2.9.2-2.x86_64.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-sendmail-8.14.5-12.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-sendmail-8.14.5-12.x86_64.rpm", # Important - "dummy-vacation-1.2.7.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-sendmail-8.14.5-12.src.rpm", - "dummy-vacation-1.2.7.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm", - "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-sendmail-8.14.5-12.x86_64.rpm", # Important + "dummy-vacation-1.2.7.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-sendmail-8.14.5-12.src.rpm", + "dummy-vacation-1.2.7.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", + ], + ) def test_smtpdaemon_greedy_all(self): packages = [ @@ -472,41 +582,53 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-postfix-2.9.2-2.i686.rpm", # Important - "dummy-postfix-2.9.2-2.x86_64.rpm", # Important - "dummy-sendmail-8.14.5-12.i686.rpm", # Important - "dummy-sendmail-8.14.5-12.x86_64.rpm", # Important - "dummy-vacation-1.2.7.1-1.i686.rpm", - "dummy-vacation-1.2.7.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-postfix-2.9.2-2.src.rpm", - "dummy-sendmail-8.14.5-12.src.rpm", - "dummy-vacation-1.2.7.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-postfix-debuginfo-2.9.2-2.i686.rpm", - "dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm", - "dummy-sendmail-debuginfo-8.14.5-12.i686.rpm", - "dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm", - "dummy-vacation-debuginfo-1.2.7.1-1.i686.rpm", - "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-postfix-2.9.2-2.i686.rpm", # Important + "dummy-postfix-2.9.2-2.x86_64.rpm", # Important + "dummy-sendmail-8.14.5-12.i686.rpm", # Important + "dummy-sendmail-8.14.5-12.x86_64.rpm", # Important + "dummy-vacation-1.2.7.1-1.i686.rpm", + "dummy-vacation-1.2.7.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-postfix-2.9.2-2.src.rpm", + "dummy-sendmail-8.14.5-12.src.rpm", + "dummy-vacation-1.2.7.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-postfix-debuginfo-2.9.2-2.i686.rpm", + "dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm", + "dummy-sendmail-debuginfo-8.14.5-12.i686.rpm", + "dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.i686.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", + ], + ) def test_smtpdaemon_greedy_all_explicit_postfix(self): # Postfix provides smtpdaemon, but we still want sendmail in because we @@ -517,41 +639,53 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-postfix-2.9.2-2.i686.rpm", - "dummy-postfix-2.9.2-2.x86_64.rpm", - "dummy-sendmail-8.14.5-12.i686.rpm", - "dummy-sendmail-8.14.5-12.x86_64.rpm", - "dummy-vacation-1.2.7.1-1.i686.rpm", - "dummy-vacation-1.2.7.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-postfix-2.9.2-2.src.rpm", - "dummy-sendmail-8.14.5-12.src.rpm", - "dummy-vacation-1.2.7.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-postfix-debuginfo-2.9.2-2.i686.rpm", - "dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm", - "dummy-sendmail-debuginfo-8.14.5-12.i686.rpm", - "dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm", - "dummy-vacation-debuginfo-1.2.7.1-1.i686.rpm", - "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-postfix-2.9.2-2.i686.rpm", + "dummy-postfix-2.9.2-2.x86_64.rpm", + "dummy-sendmail-8.14.5-12.i686.rpm", + "dummy-sendmail-8.14.5-12.x86_64.rpm", + "dummy-vacation-1.2.7.1-1.i686.rpm", + "dummy-vacation-1.2.7.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-postfix-2.9.2-2.src.rpm", + "dummy-sendmail-8.14.5-12.src.rpm", + "dummy-vacation-1.2.7.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-postfix-debuginfo-2.9.2-2.i686.rpm", + "dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm", + "dummy-sendmail-debuginfo-8.14.5-12.i686.rpm", + "dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.i686.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", + ], + ) def test_smtpdaemon_greedy_all_explicit_sendmail(self): # Same as above, but the other way around. @@ -561,41 +695,53 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-postfix-2.9.2-2.i686.rpm", - "dummy-postfix-2.9.2-2.x86_64.rpm", - "dummy-sendmail-8.14.5-12.i686.rpm", - "dummy-sendmail-8.14.5-12.x86_64.rpm", - "dummy-vacation-1.2.7.1-1.i686.rpm", - "dummy-vacation-1.2.7.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-postfix-2.9.2-2.src.rpm", - "dummy-sendmail-8.14.5-12.src.rpm", - "dummy-vacation-1.2.7.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-postfix-debuginfo-2.9.2-2.i686.rpm", - "dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm", - "dummy-sendmail-debuginfo-8.14.5-12.i686.rpm", - "dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm", - "dummy-vacation-debuginfo-1.2.7.1-1.i686.rpm", - "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-postfix-2.9.2-2.i686.rpm", + "dummy-postfix-2.9.2-2.x86_64.rpm", + "dummy-sendmail-8.14.5-12.i686.rpm", + "dummy-sendmail-8.14.5-12.x86_64.rpm", + "dummy-vacation-1.2.7.1-1.i686.rpm", + "dummy-vacation-1.2.7.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-postfix-2.9.2-2.src.rpm", + "dummy-sendmail-8.14.5-12.src.rpm", + "dummy-vacation-1.2.7.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-postfix-debuginfo-2.9.2-2.i686.rpm", + "dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm", + "dummy-sendmail-debuginfo-8.14.5-12.i686.rpm", + "dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.i686.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", + ], + ) def test_firefox(self): packages = [ @@ -609,27 +755,39 @@ class DepsolvingBase(object): self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-krb5-workstation-1.10-5.x86_64.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "Dummy-xulrunner-16.0.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "Dummy-firefox-16.0.1-1.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "Dummy-xulrunner-16.0.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-16.0.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "Dummy-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ], + ) def test_firefox_selfhosting(self): packages = [ @@ -642,36 +800,48 @@ class DepsolvingBase(object): self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-krb5-workstation-1.10-5.x86_64.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-bash-4.2.37-6.x86_64.rpm", - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-krb5-1.10-5.x86_64.rpm", - "dummy-krb5-devel-1.10-5.x86_64.rpm", # Important - "dummy-krb5-libs-1.10-5.x86_64.rpm", - "Dummy-xulrunner-16.0.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-bash-4.2.37-6.src.rpm", - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "Dummy-firefox-16.0.1-1.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-krb5-1.10-5.src.rpm", - "Dummy-xulrunner-16.0.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", - "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", - "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", # Important - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", # Important - "dummy-krb5-debuginfo-1.10-5.x86_64.rpm", - "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-bash-4.2.37-6.x86_64.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-krb5-1.10-5.x86_64.rpm", + "dummy-krb5-devel-1.10-5.x86_64.rpm", # Important + "dummy-krb5-libs-1.10-5.x86_64.rpm", + "Dummy-xulrunner-16.0.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-bash-4.2.37-6.src.rpm", + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "Dummy-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-krb5-1.10-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", # Important + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", # Important + "dummy-krb5-debuginfo-1.10-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ], + ) def test_firefox_selfhosting_with_krb5_lookaside(self): packages = [ @@ -684,27 +854,39 @@ class DepsolvingBase(object): self.assertNotIn("dummy-krb5-debuginfo-1.10-5.x86_64.rpm", pkg_map["debuginfo"]) self.assertNotIn("dummy-krb5-1.10-5.src.rpm", pkg_map["srpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "Dummy-xulrunner-16.0.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "Dummy-firefox-16.0.1-1.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "Dummy-xulrunner-16.0.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-16.0.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "Dummy-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ], + ) def test_old_dep_in_lookaside_is_not_pulled_in(self): # main repo: @@ -723,10 +905,14 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, lookaside=self.lookaside) self.assertEqual(self.broken_deps, {}) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-cockpit-docker-141-1.noarch.rpm", - "dummy-cockpit-system-141-1.noarch.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-cockpit-docker-141-1.noarch.rpm", + "dummy-cockpit-system-141-1.noarch.rpm", + ], + ) def test_does_not_exclude_from_lookaside(self): # main repo: @@ -748,9 +934,7 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, lookaside=self.lookaside) self.assertEqual(self.broken_deps, {}) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-cockpit-docker-141-1.noarch.rpm", - ]) + self.assertEqual(pkg_map["rpm"], ["dummy-cockpit-docker-141-1.noarch.rpm"]) def test_firefox_fulltree(self): packages = [ @@ -764,28 +948,40 @@ class DepsolvingBase(object): self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-krb5-workstation-1.10-5.x86_64.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-nscd-2.14-5.x86_64.rpm", - "Dummy-xulrunner-16.0.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "Dummy-firefox-16.0.1-1.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "Dummy-xulrunner-16.0.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + "Dummy-xulrunner-16.0.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "Dummy-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ], + ) def test_firefox_selfhosting_fulltree(self): packages = [ @@ -797,39 +993,51 @@ class DepsolvingBase(object): self.assertNotIn("dummy-krb5-devel-1.10-5.i686.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-bash-4.2.37-6.x86_64.rpm", - "dummy-bash-doc-4.2.37-6.noarch.rpm", - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-krb5-1.10-5.x86_64.rpm", - "dummy-krb5-devel-1.10-5.x86_64.rpm", # Important - "dummy-krb5-libs-1.10-5.x86_64.rpm", - "dummy-krb5-workstation-1.10-5.x86_64.rpm", # Important - "dummy-nscd-2.14-5.x86_64.rpm", - "Dummy-xulrunner-16.0.1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-bash-4.2.37-6.src.rpm", - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "Dummy-firefox-16.0.1-1.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-krb5-1.10-5.src.rpm", - "Dummy-xulrunner-16.0.1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", - "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", - "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-krb5-debuginfo-1.10-5.x86_64.rpm", - "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-bash-4.2.37-6.x86_64.rpm", + "dummy-bash-doc-4.2.37-6.noarch.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-krb5-1.10-5.x86_64.rpm", + "dummy-krb5-devel-1.10-5.x86_64.rpm", # Important + "dummy-krb5-libs-1.10-5.x86_64.rpm", + "dummy-krb5-workstation-1.10-5.x86_64.rpm", # Important + "dummy-nscd-2.14-5.x86_64.rpm", + "Dummy-xulrunner-16.0.1-1.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-bash-4.2.37-6.src.rpm", + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "Dummy-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-krb5-1.10-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-krb5-debuginfo-1.10-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ], + ) def test_krb5_fulltree(self): packages = [ @@ -840,28 +1048,40 @@ class DepsolvingBase(object): self.assertNotIn("dummy-krb5-devel-1.10-5.i686.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-krb5-1.10-5.x86_64.rpm", - "dummy-krb5-devel-1.10-5.x86_64.rpm", # Important - "dummy-krb5-libs-1.10-5.x86_64.rpm", - "dummy-krb5-workstation-1.10-5.x86_64.rpm", # Important - "dummy-nscd-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-krb5-1.10-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-krb5-debuginfo-1.10-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-krb5-1.10-5.x86_64.rpm", + "dummy-krb5-devel-1.10-5.x86_64.rpm", # Important + "dummy-krb5-libs-1.10-5.x86_64.rpm", + "dummy-krb5-workstation-1.10-5.x86_64.rpm", # Important + "dummy-nscd-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-krb5-1.10-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-krb5-debuginfo-1.10-5.x86_64.rpm", + ], + ) def test_bash_multilib(self): packages = [ @@ -872,30 +1092,42 @@ class DepsolvingBase(object): # 'dummy-bash' req already satisfied by bash.i686 self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", # Important - "dummy-bash-doc-4.2.37-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-nscd-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.i686.rpm", - "dummy-bash-debugsource-4.2.37-6.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.i686.rpm", + "dummy-bash-debugsource-4.2.37-6.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_wildcard_with_multilib_blacklist(self): packages = [ @@ -903,21 +1135,33 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, multilib_blacklist=['dummy-glibc*']) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_bash_multilib_exclude(self): # test if excluding a package really works @@ -931,29 +1175,41 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-bash-doc-4.2.37-6.noarch.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", # Important - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-nscd-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.i686.rpm", - "dummy-bash-debugsource-4.2.37-6.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.i686.rpm", + "dummy-bash-debugsource-4.2.37-6.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_bash_multilib_exclude_source(self): packages = [ @@ -964,26 +1220,38 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.src.rpm", pkg_map["srpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.i686.rpm", - "dummy-bash-debugsource-4.2.37-6.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.i686.rpm", + "dummy-bash-debugsource-4.2.37-6.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_bash_multilib_greedy(self): packages = [ @@ -991,36 +1259,48 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all", fulltree=True) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", # Important - "dummy-bash-4.2.37-6.x86_64.rpm", # Important - "dummy-bash-doc-4.2.37-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-nscd-2.14-5.i686.rpm", - "dummy-nscd-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.i686.rpm", - "dummy-bash-debugsource-4.2.37-6.i686.rpm", - "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", - "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-nscd-2.14-5.i686.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.i686.rpm", + "dummy-bash-debugsource-4.2.37-6.i686.rpm", + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) @unittest.skip('This test is broken') def test_bash_multilib_nogreedy(self): @@ -1031,30 +1311,42 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", # Important - "dummy-bash-doc-4.2.37-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - # "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - # "dummy-glibc-common-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.i686.rpm", - "dummy-bash-debugsource-4.2.37-6.i686.rpm", - # "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - # "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + # "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + # "dummy-glibc-common-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.i686.rpm", + "dummy-bash-debugsource-4.2.37-6.i686.rpm", + # "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + # "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_bash_multilib_filter_greedy(self): packages = [ @@ -1065,33 +1357,45 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.x86_64.rpm", # Important - "dummy-bash-doc-4.2.37-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-nscd-2.14-5.i686.rpm", - "dummy-nscd-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", - "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-nscd-2.14-5.i686.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_bash_filter_greedy(self): packages = [ @@ -1104,14 +1408,16 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-filesystem-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-filesystem-4.2.37-6.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-filesystem-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-filesystem-4.2.37-6.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_ipw3945_kmod(self): # every package name is different @@ -1120,16 +1426,20 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none", fulltree=True) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-kmod-ipw3945-1.2.0-4.20.x86_64.rpm", # Important - "dummy-kmod-ipw3945-xen-1.2.0-4.20.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-ipw3945-kmod-1.2.0-4.20.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-ipw3945-kmod-debuginfo-1.2.0-4.20.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-kmod-ipw3945-1.2.0-4.20.x86_64.rpm", # Important + "dummy-kmod-ipw3945-xen-1.2.0-4.20.x86_64.rpm", + ], + ) + self.assertEqual( + pkg_map["srpm"], ["dummy-ipw3945-kmod-1.2.0-4.20.src.rpm"] + ) + self.assertEqual( + pkg_map["debuginfo"], ["dummy-ipw3945-kmod-debuginfo-1.2.0-4.20.x86_64.rpm"] + ) def test_multilib_method_devel_runtime(self): packages = [ @@ -1138,31 +1448,43 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, greedy="none", fulltree=False, multilib_methods=["devel", "runtime"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-lvm2-2.02.84-4.x86_64.rpm", - "dummy-lvm2-devel-2.02.84-4.i686.rpm", # Important - "dummy-lvm2-devel-2.02.84-4.x86_64.rpm", # Important - "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-lvm2-2.02.84-4.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-lvm2-debuginfo-2.02.84-4.i686.rpm", - "dummy-lvm2-debuginfo-2.02.84-4.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-lvm2-2.02.84-4.x86_64.rpm", + "dummy-lvm2-devel-2.02.84-4.i686.rpm", # Important + "dummy-lvm2-devel-2.02.84-4.x86_64.rpm", # Important + "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-lvm2-2.02.84-4.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-lvm2-debuginfo-2.02.84-4.i686.rpm", + "dummy-lvm2-debuginfo-2.02.84-4.x86_64.rpm", + ], + ) def test_selinux_policy_base(self): packages = [ @@ -1170,15 +1492,23 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="ppc64") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important - "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-freeipa-2.2.0-1.src.rpm", - "dummy-selinux-policy-3.10.0-121.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important + "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", # Important + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-freeipa-2.2.0-1.src.rpm", + "dummy-selinux-policy-3.10.0-121.src.rpm", + ], + ) + self.assertEqual(pkg_map["debuginfo"], []) def test_selinux_policy_base_greedy_build(self): packages = [ @@ -1186,17 +1516,25 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="ppc64") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important - "dummy-selinux-policy-minimal-3.10.0-121.noarch.rpm", - "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", # Important - "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm" - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-freeipa-2.2.0-1.src.rpm", - "dummy-selinux-policy-3.10.0-121.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important + "dummy-selinux-policy-minimal-3.10.0-121.noarch.rpm", + "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", # Important + "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm" + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-freeipa-2.2.0-1.src.rpm", + "dummy-selinux-policy-3.10.0-121.src.rpm", + ], + ) + self.assertEqual(pkg_map["debuginfo"], []) def test_selinux_policy_base_existing_provides(self): packages = [ @@ -1207,15 +1545,23 @@ class DepsolvingBase(object): self.assertNotIn("dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important - "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-freeipa-2.2.0-1.src.rpm", - "dummy-selinux-policy-3.10.0-121.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important + "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm", # Important + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-freeipa-2.2.0-1.src.rpm", + "dummy-selinux-policy-3.10.0-121.src.rpm", + ], + ) + self.assertEqual(pkg_map["debuginfo"], []) def test_selinux_policy_doc_fulltree(self): packages = [ @@ -1223,16 +1569,18 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, fulltree=True) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-selinux-policy-doc-3.10.0-121.noarch.rpm", - "dummy-selinux-policy-minimal-3.10.0-121.noarch.rpm", - "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", - "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-selinux-policy-3.10.0-121.src.rpm" - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-selinux-policy-doc-3.10.0-121.noarch.rpm", + "dummy-selinux-policy-minimal-3.10.0-121.noarch.rpm", + "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", + "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-selinux-policy-3.10.0-121.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_AdobeReader_enu_nosrc(self): packages = [ @@ -1240,23 +1588,35 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-AdobeReader_enu-9.5.1-1.i486.rpm", # Important - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-AdobeReader_enu-9.5.1-1.nosrc.rpm", - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-AdobeReader_enu-9.5.1-1.i486.rpm", # Important + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-AdobeReader_enu-9.5.1-1.nosrc.rpm", + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_imsettings(self): packages = [ @@ -1267,14 +1627,16 @@ class DepsolvingBase(object): self.assertNotIn("dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", pkg_map["rpm"]) # prefers qt over gnome (shorter name) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important - "dummy-imsettings-qt-1.2.9-1.x86_64.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-imsettings-1.2.9-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important + "dummy-imsettings-qt-1.2.9-1.x86_64.rpm", # Important + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-imsettings-1.2.9-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_imsettings_basic_desktop(self): packages = [ @@ -1288,14 +1650,16 @@ class DepsolvingBase(object): self.assertNotIn("dummy-imsettings-qt-1.2.9-1.x86_64.rpm", pkg_map["rpm"]) # prefers gnome over qt (condrequires in @basic-desktop) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important - "dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-imsettings-1.2.9-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important + "dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", # Important + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-imsettings-1.2.9-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_imsettings_basic_desktop_nodeps(self): packages = [ @@ -1311,13 +1675,9 @@ class DepsolvingBase(object): self.assertNotIn("dummy-imsettings-qt-1.2.9-1.x86_64.rpm", pkg_map["rpm"]) # prefers gnome over qt (condrequires in @basic-desktop) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-imsettings-1.2.9-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + self.assertEqual(pkg_map["rpm"], ["dummy-imsettings-1.2.9-1.x86_64.rpm"]) + self.assertEqual(pkg_map["srpm"], ["dummy-imsettings-1.2.9-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_imsettings_basic_desktop_and_qt(self): packages = [ @@ -1330,15 +1690,17 @@ class DepsolvingBase(object): pkg_map = self.go(packages, groups, greedy="none", fulltree=False, arch="x86_64") # prefers gnome over qt (condrequires in @basic-desktop) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important - "dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", # Important - "dummy-imsettings-qt-1.2.9-1.x86_64.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-imsettings-1.2.9-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important + "dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", # Important + "dummy-imsettings-qt-1.2.9-1.x86_64.rpm", # Important + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-imsettings-1.2.9-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_bash_nodeps(self): packages = [ @@ -1350,16 +1712,16 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-5.x86_64.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-bash-4.2.37-6.x86_64.rpm", # Important - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-bash-4.2.37-6.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", - "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", - ]) + self.assertEqual(pkg_map["rpm"], ["dummy-bash-4.2.37-6.x86_64.rpm"]) + self.assertEqual(pkg_map["srpm"], ["dummy-bash-4.2.37-6.src.rpm"]) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", + ], + ) def test_bash_fulltree_nodeps(self): packages = [ @@ -1371,17 +1733,23 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-5.x86_64.rpm", pkg_map["rpm"]) self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-bash-4.2.37-6.x86_64.rpm", # Important - "dummy-bash-doc-4.2.37-6.noarch.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-bash-4.2.37-6.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", - "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-bash-4.2.37-6.src.rpm"]) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "dummy-bash-debugsource-4.2.37-6.x86_64.rpm", + ], + ) def test_lookaside_empty(self): # if the input repo and lookaside repo are the same, output must be empty @@ -1391,9 +1759,9 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, lookaside=self.repo, nodeps=True, fulltree=True) - self.assertItemsEqual(pkg_map["rpm"], []) - self.assertItemsEqual(pkg_map["srpm"], []) - self.assertItemsEqual(pkg_map["debuginfo"], []) + self.assertEqual(pkg_map["rpm"], []) + self.assertEqual(pkg_map["srpm"], []) + self.assertEqual(pkg_map["debuginfo"], []) def test_exclude_wildcards(self): packages = [ @@ -1405,18 +1773,24 @@ class DepsolvingBase(object): greedy="none", nodeps=True, fulltree=True) # neither dummy-bash or dummy-basesystem is pulled in - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-nscd-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-glibc-2.14-5.src.rpm"]) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_atlas_greedy_none(self): packages = [ @@ -1424,14 +1798,16 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="x86_64") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-atlas-3.8.4-7.x86_64.rpm", - "dummy-atlas-devel-3.8.4-7.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-atlas-3.8.4-7.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.x86_64.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-atlas-3.8.4-7.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_atlas_greedy_build(self): packages = [ @@ -1440,15 +1816,17 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="x86_64") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-atlas-3.8.4-7.x86_64.rpm", - "dummy-atlas-devel-3.8.4-7.x86_64.rpm", - "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-atlas-3.8.4-7.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.x86_64.rpm", + "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-atlas-3.8.4-7.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_atlas_greedy_build_multilib_devel(self): packages = [ @@ -1457,16 +1835,18 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, greedy="build", multilib_methods=["devel", "runtime"], fulltree=False, arch="x86_64") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-atlas-3.8.4-7.x86_64.rpm", - "dummy-atlas-devel-3.8.4-7.i686.rpm", - "dummy-atlas-devel-3.8.4-7.x86_64.rpm", - "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-atlas-3.8.4-7.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.i686.rpm", + "dummy-atlas-devel-3.8.4-7.x86_64.rpm", + "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-atlas-3.8.4-7.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_atlas_greedy_build_multilib_devel_32bit(self): packages = [ @@ -1475,15 +1855,17 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, greedy="build", multilib_methods=["devel", "runtime"], fulltree=False, arch="x86_64") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-atlas-3.8.4-7.x86_64.rpm", - "dummy-atlas-devel-3.8.4-7.i686.rpm", - "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-atlas-3.8.4-7.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.i686.rpm", + "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-atlas-3.8.4-7.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_atlas_greedy_all(self): packages = [ @@ -1491,22 +1873,24 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all", fulltree=False, arch="x86_64") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-atlas-3.8.4-7.i686.rpm", - "dummy-atlas-3dnow-3.8.4-7.i686.rpm", - "dummy-atlas-devel-3.8.4-7.i686.rpm", - "dummy-atlas-sse-3.8.4-7.i686.rpm", - "dummy-atlas-sse2-3.8.4-7.i686.rpm", - "dummy-atlas-sse3-3.8.4-7.i686.rpm", + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-atlas-3.8.4-7.i686.rpm", + "dummy-atlas-3dnow-3.8.4-7.i686.rpm", + "dummy-atlas-devel-3.8.4-7.i686.rpm", + "dummy-atlas-sse-3.8.4-7.i686.rpm", + "dummy-atlas-sse2-3.8.4-7.i686.rpm", + "dummy-atlas-sse3-3.8.4-7.i686.rpm", - "dummy-atlas-3.8.4-7.x86_64.rpm", - "dummy-atlas-devel-3.8.4-7.x86_64.rpm", - "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-atlas-3.8.4-7.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.x86_64.rpm", + "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-atlas-3.8.4-7.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_skype(self): packages = [ @@ -1514,25 +1898,37 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="x86_64") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-skype-4.2.0.13-1.i586.rpm", - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-skype-4.2.0.13-1.i586.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + ], + ) # no SRPM for skype - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + ], + ) def test_prepopulate(self): packages = [ @@ -1545,32 +1941,44 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, prepopulate=prepopulate) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-lvm2-2.02.84-4.x86_64.rpm", - "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-lvm2-2.02.84-4.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.i686.rpm", - "dummy-bash-debugsource-4.2.37-6.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-lvm2-debuginfo-2.02.84-4.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-lvm2-2.02.84-4.x86_64.rpm", + "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-lvm2-2.02.84-4.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.i686.rpm", + "dummy-bash-debugsource-4.2.37-6.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-lvm2-debuginfo-2.02.84-4.x86_64.rpm", + ], + ) def test_langpacks(self): packages = [ @@ -1578,17 +1986,25 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-release-notes-1.2-1.noarch.rpm", - "dummy-release-notes-cs-CZ-1.2-1.noarch.rpm", - "dummy-release-notes-en-US-1.2-1.noarch.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-release-notes-1.2-1.src.rpm", - "dummy-release-notes-cs-CZ-1.2-1.src.rpm", - "dummy-release-notes-en-US-1.2-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-release-notes-1.2-1.noarch.rpm", + "dummy-release-notes-cs-CZ-1.2-1.noarch.rpm", + "dummy-release-notes-en-US-1.2-1.noarch.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-release-notes-1.2-1.src.rpm", + "dummy-release-notes-cs-CZ-1.2-1.src.rpm", + "dummy-release-notes-en-US-1.2-1.src.rpm", + ], + ) + self.assertEqual(pkg_map["debuginfo"], []) def test_multilib_whitelist(self): # whitelist must work regardless if multilib_method is specified or not @@ -1598,24 +2014,36 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, multilib_whitelist=["dummy-glibc"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-basesystem-10.0-6.noarch.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ], + ) def test_noarch_debuginfo(self): packages = [ @@ -1623,15 +2051,14 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-mingw32-qt5-qtbase-5.6.0-1.noarch.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-mingw-qt5-qtbase-5.6.0-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-mingw32-qt5-qtbase-debuginfo-5.6.0-1.noarch.rpm", - ]) + self.assertEqual( + pkg_map["rpm"], ["dummy-mingw32-qt5-qtbase-5.6.0-1.noarch.rpm"] + ) + self.assertEqual(pkg_map["srpm"], ["dummy-mingw-qt5-qtbase-5.6.0-1.src.rpm"]) + self.assertEqual( + pkg_map["debuginfo"], + ["dummy-mingw32-qt5-qtbase-debuginfo-5.6.0-1.noarch.rpm"] + ) def test_input_by_wildcard(self): packages = [ @@ -1642,15 +2069,23 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-release-notes-cs-CZ-1.2-1.noarch.rpm", - "dummy-release-notes-en-US-1.2-1.noarch.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-release-notes-cs-CZ-1.2-1.src.rpm", - "dummy-release-notes-en-US-1.2-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-release-notes-cs-CZ-1.2-1.noarch.rpm", + "dummy-release-notes-en-US-1.2-1.noarch.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-release-notes-cs-CZ-1.2-1.src.rpm", + "dummy-release-notes-en-US-1.2-1.src.rpm", + ], + ) + self.assertEqual(pkg_map["debuginfo"], []) def test_requires_pre_post(self): packages = [ @@ -1658,15 +2093,17 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-perl-1.0.0-1.x86_64.rpm", - "dummy-perl-macros-1.0.0-1.x86_64.rpm", # Requires(pre) - "dummy-perl-utils-1.0.0-1.x86_64.rpm", # Requires(post) - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-perl-1.0.0-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-perl-1.0.0-1.x86_64.rpm", + "dummy-perl-macros-1.0.0-1.x86_64.rpm", # Requires(pre) + "dummy-perl-utils-1.0.0-1.x86_64.rpm", # Requires(post) + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-perl-1.0.0-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_multilib_exclude_pattern_does_not_match_noarch(self): packages = [ @@ -1676,14 +2113,9 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-release-notes-en-US-1.2-1.noarch.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-release-notes-en-US-1.2-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - ]) + self.assertEqual(pkg_map["rpm"], ["dummy-release-notes-en-US-1.2-1.noarch.rpm"]) + self.assertEqual(pkg_map["srpm"], ["dummy-release-notes-en-US-1.2-1.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) @unittest.skipUnless(HAS_YUM, 'YUM only available on Python 2') @@ -1863,17 +2295,20 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): pkg_map = self.go(packages, None) - self.assertItemsEqual(pkg_map["rpm"], [ - "libuser-1-1.i686.rpm", - "python-libuser-1-1.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "libuser-1-1.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "libuser-debuginfo-1-1.i686.rpm", - "python-libuser-debuginfo-1-1.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + ["libuser-1-1.i686.rpm", "python-libuser-1-1.x86_64.rpm"], + ) + self.assertEqual(pkg_map["srpm"], ["libuser-1-1.src.rpm"]) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "libuser-debuginfo-1-1.i686.rpm", + "python-libuser-debuginfo-1-1.x86_64.rpm", + ], + ) def test_skype(self): packages = [ @@ -1881,23 +2316,35 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): ] pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="x86_64") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-skype-4.2.0.13-1.i586.rpm", - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-skype-4.2.0.13-1.i586.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + ], + ) # no SRPM for skype - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + ], + ) def test_bash_multilib_exclude_debuginfo(self): packages = [ @@ -1907,23 +2354,35 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): ] pkg_map = self.go(packages, None, greedy="none") - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-bash-4.2.37-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + ], + ) def test_exclude_wildcards(self): packages = [ @@ -1935,17 +2394,19 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): greedy="none", nodeps=True, fulltree=True) # neither dummy-bash or dummy-basesystem is pulled in - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-nscd-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-glibc-2.14-5.src.rpm"]) + self.assertEqual( + pkg_map["debuginfo"], ["dummy-glibc-debuginfo-2.14-5.x86_64.rpm"] + ) def test_bash_multilib_exclude_source(self): packages = [ @@ -1956,24 +2417,36 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): self.assertNotIn("dummy-bash-4.2.37-6.src.rpm", pkg_map["srpm"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-bash-4.2.37-6.i686.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-bash-debuginfo-4.2.37-6.i686.rpm", - "dummy-bash-debugsource-4.2.37-6.i686.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-bash-debuginfo-4.2.37-6.i686.rpm", + "dummy-bash-debugsource-4.2.37-6.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + ], + ) def test_ipw3945_kmod(self): # every package name is different @@ -1982,14 +2455,16 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): ] pkg_map = self.go(packages, None, greedy="none", fulltree=True) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-kmod-ipw3945-1.2.0-4.20.x86_64.rpm", # Important - "dummy-kmod-ipw3945-xen-1.2.0-4.20.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-ipw3945-kmod-1.2.0-4.20.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], []) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-kmod-ipw3945-1.2.0-4.20.x86_64.rpm", # Important + "dummy-kmod-ipw3945-xen-1.2.0-4.20.x86_64.rpm", + ], + ) + self.assertEqual(pkg_map["srpm"], ["dummy-ipw3945-kmod-1.2.0-4.20.src.rpm"]) + self.assertEqual(pkg_map["debuginfo"], []) def test_multilib_method_devel_runtime(self): packages = [ @@ -1998,27 +2473,39 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): pkg_map = self.go(packages, None, greedy="none", fulltree=False, multilib_methods=["devel", "runtime"]) - self.assertItemsEqual(pkg_map["rpm"], [ - "dummy-basesystem-10.0-6.noarch.rpm", - "dummy-filesystem-4.2.37-6.x86_64.rpm", - "dummy-glibc-2.14-5.x86_64.rpm", - "dummy-glibc-2.14-5.i686.rpm", - "dummy-glibc-common-2.14-5.x86_64.rpm", - "dummy-lvm2-2.02.84-4.x86_64.rpm", - "dummy-lvm2-devel-2.02.84-4.i686.rpm", # Important - "dummy-lvm2-devel-2.02.84-4.x86_64.rpm", # Important - "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", - ]) - self.assertItemsEqual(pkg_map["srpm"], [ - "dummy-basesystem-10.0-6.src.rpm", - "dummy-filesystem-4.2.37-6.src.rpm", - "dummy-glibc-2.14-5.src.rpm", - "dummy-lvm2-2.02.84-4.src.rpm", - ]) - self.assertItemsEqual(pkg_map["debuginfo"], [ - "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", - "dummy-glibc-debuginfo-2.14-5.i686.rpm", - "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", - "dummy-lvm2-debuginfo-2.02.84-4.x86_64.rpm", - ]) + six.assertCountEqual( + self, + pkg_map["rpm"], + [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-lvm2-2.02.84-4.x86_64.rpm", + "dummy-lvm2-devel-2.02.84-4.i686.rpm", # Important + "dummy-lvm2-devel-2.02.84-4.x86_64.rpm", # Important + "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["srpm"], + [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-lvm2-2.02.84-4.src.rpm", + ], + ) + six.assertCountEqual( + self, + pkg_map["debuginfo"], + [ + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-lvm2-debuginfo-2.02.84-4.x86_64.rpm", + ], + ) diff --git a/tests/test_gather_method_hybrid.py b/tests/test_gather_method_hybrid.py index dddb2bbb..585f8e62 100644 --- a/tests/test_gather_method_hybrid.py +++ b/tests/test_gather_method_hybrid.py @@ -6,6 +6,8 @@ import mock import os import sys +import six + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases.gather.methods import method_hybrid as hybrid @@ -205,7 +207,7 @@ class TestMethodHybrid(helpers.PungiTestCase): ] expanded = m.expand_list(["foo*"]) - self.assertItemsEqual([p.name for p in expanded], ["foo", "foo-en"]) + six.assertCountEqual(self, [p.name for p in expanded], ["foo", "foo-en"]) class MockModule(object): @@ -331,8 +333,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): filter_packages=[("foo", None)], ) - self.assertItemsEqual(res[0], []) - self.assertItemsEqual(res[1], ["m1"]) + self.assertEqual(res[0], set()) + self.assertEqual(res[1], set(["m1"])) self.assertEqual(po.call_args_list, [mock.call(self.logfile1)]) self.assertEqual( run.call_args_list, @@ -426,8 +428,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): filter_packages=[], ) - self.assertItemsEqual(res[0], po.return_value[0]) - self.assertItemsEqual(res[1], []) + six.assertCountEqual(self, res[0], po.return_value[0]) + self.assertEqual(res[1], set()) self.assertEqual(po.call_args_list, [mock.call(self.logfile1)]) self.assertEqual( run.call_args_list, @@ -481,14 +483,15 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): filter_packages=[], ) - self.assertItemsEqual( + six.assertCountEqual( + self, res[0], [ ("pkg-1.0-1", "x86_64", frozenset()), ("pkg-debuginfo-1.0-1", "x86_64", frozenset()), ], ) - self.assertItemsEqual(res[1], []) + self.assertEqual(res[1], set()) self.assertEqual( po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)] ) @@ -552,8 +555,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): filter_packages=["foo"], ) - self.assertItemsEqual(res[0], final) - self.assertItemsEqual(res[1], []) + six.assertCountEqual(self, res[0], final) + self.assertEqual(res[1], set()) self.assertEqual( po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)] ) @@ -639,7 +642,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): filter_packages=[], ) - self.assertItemsEqual( + six.assertCountEqual( + self, res[0], [ ("pkg-devel-1.0-1", "x86_64", frozenset()), @@ -647,7 +651,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): ("pkg-devel-1.0-1", "i686", frozenset()), ] ) - self.assertItemsEqual(res[1], []) + self.assertEqual(res[1], set()) self.assertEqual( po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)] ) @@ -760,7 +764,8 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): filter_packages=[], ) - self.assertItemsEqual( + six.assertCountEqual( + self, res[0], [ ("pkg-devel-1.0-1", "x86_64", frozenset()), @@ -768,7 +773,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): ("foo-1.0-1", "i686", frozenset()), ], ) - self.assertItemsEqual(res[1], []) + self.assertEqual(res[1], set()) self.assertEqual( po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)] ) @@ -981,4 +986,4 @@ class TestFilterModules(helpers.PungiTestCase): hybrid.filter_modules(self.variant, "x86_64", ["mod:1"]) - self.assertItemsEqual(self.variant.arch_mmds["x86_64"].keys(), ["mod:1"]) + self.assertEqual(list(self.variant.arch_mmds["x86_64"].keys()), ["mod:1"]) diff --git a/tests/test_gather_method_nodeps.py b/tests/test_gather_method_nodeps.py index 7a9f1709..6b077bb8 100644 --- a/tests/test_gather_method_nodeps.py +++ b/tests/test_gather_method_nodeps.py @@ -4,6 +4,8 @@ import mock import os import sys +import six + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases.gather.methods import method_nodeps as nodeps @@ -20,6 +22,12 @@ class TestWritePungiConfig(helpers.PungiTestCase): def test_expand_group(self): packages = nodeps.expand_groups(self.compose, 'x86_64', None, ['core', 'text-internet']) - self.assertItemsEqual(packages, [('dummy-bash', 'x86_64'), - ('dummy-elinks', 'x86_64'), - ('dummy-tftp', 'x86_64')]) + six.assertCountEqual( + self, + packages, + [ + ("dummy-bash", "x86_64"), + ("dummy-elinks", "x86_64"), + ("dummy-tftp", "x86_64"), + ], + ) diff --git a/tests/test_gather_phase.py b/tests/test_gather_phase.py index fe8092cc..c82a8ef5 100644 --- a/tests/test_gather_phase.py +++ b/tests/test_gather_phase.py @@ -10,6 +10,8 @@ try: except ImportError: import unittest +import six + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases import gather @@ -122,7 +124,8 @@ class TestGatherWrapper(helpers.PungiTestCase): self.assertEqual(result, {'x86_64': {'Server': expected_server_packages, 'Server-HA': expected_addon_packages}}) - self.assertItemsEqual( + six.assertCountEqual( + self, write_packages.call_args_list, [mock.call(self.compose, 'x86_64', self.variant, expected_server_packages, path_prefix='/build'), @@ -149,7 +152,8 @@ class TestGatherWrapper(helpers.PungiTestCase): self.assertEqual(result, {'x86_64': {'Server': expected_server_packages, 'Server-LP': expected_lp_packages}}) - self.assertItemsEqual( + six.assertCountEqual( + self, write_packages.call_args_list, [mock.call(self.compose, 'x86_64', self.variant, expected_server_packages, path_prefix='/build'), @@ -176,7 +180,8 @@ class TestGatherWrapper(helpers.PungiTestCase): self.assertEqual(result, {'x86_64': {'Server': expected_server_packages, 'Server-optional': expected_optional_packages}}) - self.assertItemsEqual( + six.assertCountEqual( + self, write_packages.call_args_list, [mock.call(self.compose, 'x86_64', self.variant, expected_server_packages, path_prefix='/build'), @@ -223,7 +228,8 @@ class TestGatherWrapper(helpers.PungiTestCase): 'Server-optional': expected_optional_packages, 'Server-HA': expected_addon_packages, 'Server-LP': expected_lp_packages}}) - self.assertItemsEqual( + six.assertCountEqual( + self, write_packages.call_args_list, [mock.call(self.compose, 'x86_64', self.compose.all_variants['Server'], expected_server_packages, path_prefix='/build'), @@ -263,7 +269,8 @@ class TestGatherWrapper(helpers.PungiTestCase): self.assertEqual(result, {'x86_64': {'Server': expected_server_packages, 'Server-HA': expected_addon_packages, 'Server-LP': expected_lp_packages}}) - self.assertItemsEqual( + six.assertCountEqual( + self, write_packages.call_args_list, [mock.call(self.compose, 'x86_64', self.compose.all_variants['Server'], expected_server_packages, path_prefix='/build'), @@ -309,8 +316,8 @@ class TestGetSystemRelease(unittest.TestCase): _make_materialized_pkgsets({"x86_64": pkgset}), ) - self.assertItemsEqual(packages, []) - self.assertItemsEqual(filter_packages, []) + self.assertEqual(packages, set()) + self.assertEqual(filter_packages, set()) def test_picks_single(self): pkgset = MockPackageSet( @@ -323,8 +330,8 @@ class TestGetSystemRelease(unittest.TestCase): _make_materialized_pkgsets({"x86_64": pkgset}), ) - self.assertItemsEqual(packages, [('dummy', None)]) - self.assertItemsEqual(filter_packages, []) + self.assertEqual(packages, set([("dummy", None)])) + self.assertEqual(filter_packages, set()) def test_prefers_variant(self): pkgset = MockPackageSet( @@ -338,8 +345,8 @@ class TestGetSystemRelease(unittest.TestCase): [MaterializedPackageSet({"x86_64": pkgset}, {})], ) - self.assertItemsEqual(packages, [('system-release-server', None)]) - self.assertItemsEqual(filter_packages, [('system-release', None)]) + self.assertEqual(packages, set([("system-release-server", None)])) + self.assertEqual(filter_packages, set([("system-release", None)])) def test_no_best_match(self): pkgset = MockPackageSet( @@ -372,10 +379,12 @@ class TestGetSystemRelease(unittest.TestCase): [MaterializedPackageSet({"x86_64": pkgset}, {})], ) - self.assertItemsEqual(packages, [('system-release-server', None)]) - self.assertItemsEqual(filter_packages, - [('system-release-client', None), - ('system-release', None)]) + self.assertEqual(packages, set([("system-release-server", None)])) + six.assertCountEqual( + self, + filter_packages, + set([("system-release-client", None), ("system-release", None)]), + ) class TestTrimPackages(unittest.TestCase): @@ -465,21 +474,25 @@ class TestWritePackages(helpers.PungiTestCase): with open(os.path.join(self.topdir, 'work', 'x86_64', 'package_list', 'Server.x86_64.rpm.conf')) as f: - self.assertItemsEqual(f.read().strip().split('\n'), - ['/build/foo-1.0-1.x86_64.rpm', - '/build/foo-common-1.0-1.x86_64.rpm', - '/build/bar-1.0-1.noarch.rpm']) + six.assertCountEqual( + self, + f.read().strip().split("\n"), + ["/build/foo-1.0-1.x86_64.rpm", + "/build/foo-common-1.0-1.x86_64.rpm", + "/build/bar-1.0-1.noarch.rpm"] + ) with open(os.path.join(self.topdir, 'work', 'x86_64', 'package_list', 'Server.x86_64.srpm.conf')) as f: - self.assertItemsEqual(f.read().strip().split('\n'), - ['/build/foo-1.0-1.src.rpm', - '/build/bar-1.0-1.src.rpm']) + six.assertCountEqual( + self, + f.read().strip().split("\n"), + ["/build/foo-1.0-1.src.rpm", "/build/bar-1.0-1.src.rpm"], + ) with open(os.path.join(self.topdir, 'work', 'x86_64', 'package_list', 'Server.x86_64.debuginfo.conf')) as f: - self.assertItemsEqual(f.read().strip().split('\n'), - ['/build/foo-debuginfo-1.0-1.x86_64.rpm']) + self.assertEqual(f.read(), "/build/foo-debuginfo-1.0-1.x86_64.rpm\n") class TestGetVariantPackages(helpers.PungiTestCase): @@ -487,9 +500,9 @@ class TestGetVariantPackages(helpers.PungiTestCase): compose = helpers.DummyCompose(self.topdir, {}) packages, groups, filter_packages = gather.get_variant_packages( compose, 'x86_64', None, 'comps') - self.assertItemsEqual(packages, []) - self.assertItemsEqual(groups, []) - self.assertItemsEqual(filter_packages, []) + self.assertEqual(packages, set()) + self.assertEqual(groups, set()) + self.assertEqual(filter_packages, set()) @mock.patch('pungi.phases.gather.get_gather_source') def test_just_source(self, get_gather_source): @@ -500,9 +513,9 @@ class TestGetVariantPackages(helpers.PungiTestCase): packages, groups, filter_packages = gather.get_variant_packages( compose, 'x86_64', compose.variants['Server'], 'comps') - self.assertItemsEqual(packages, ['foo']) - self.assertItemsEqual(groups, ['core']) - self.assertItemsEqual(filter_packages, []) + self.assertEqual(packages, set(["foo"])) + self.assertEqual(groups, set(["core"])) + self.assertEqual(filter_packages, set()) @mock.patch('pungi.phases.gather.get_gather_source') def test_filter_system_release(self, get_gather_source): @@ -521,9 +534,9 @@ class TestGetVariantPackages(helpers.PungiTestCase): compose.variants["Server"], "comps", package_sets=[MaterializedPackageSet({"x86_64": pkgset}, {})], ) - self.assertItemsEqual(packages, [('system-release-server', None)]) - self.assertItemsEqual(groups, []) - self.assertItemsEqual(filter_packages, [('system-release', None)]) + self.assertEqual(packages, set([("system-release-server", None)])) + self.assertEqual(groups, set()) + self.assertEqual(filter_packages, set([("system-release", None)])) @mock.patch('pungi.phases.gather.get_gather_source') def test_disable_filter_system_release(self, get_gather_source): @@ -545,9 +558,9 @@ class TestGetVariantPackages(helpers.PungiTestCase): "comps", package_sets=[MaterializedPackageSet({"x86_64": pkgset}, {})], ) - self.assertItemsEqual(packages, []) - self.assertItemsEqual(groups, []) - self.assertItemsEqual(filter_packages, []) + self.assertEqual(packages, set()) + self.assertEqual(groups, set()) + self.assertEqual(filter_packages, set()) @mock.patch('pungi.phases.gather.get_gather_source') def test_optional_gets_parent_and_addon(self, get_gather_source): @@ -570,9 +583,9 @@ class TestGetVariantPackages(helpers.PungiTestCase): packages, groups, filter_packages = gather.get_variant_packages( compose, 'x86_64', compose.all_variants['Server-optional'], 'comps') - self.assertItemsEqual(packages, ['server-pkg', 'addon-pkg', 'opt-pkg']) - self.assertItemsEqual(groups, ['server-group', 'addon-group', 'opt-group']) - self.assertItemsEqual(filter_packages, []) + six.assertCountEqual(self, packages, ["server-pkg", "addon-pkg", "opt-pkg"]) + six.assertCountEqual(self, groups, ["server-group", "addon-group", "opt-group"]) + self.assertEqual(filter_packages, set()) @mock.patch('pungi.phases.gather.get_gather_source') def test_optional_does_not_inherit_filters(self, get_gather_source): @@ -590,9 +603,9 @@ class TestGetVariantPackages(helpers.PungiTestCase): packages, groups, filter_packages = gather.get_variant_packages( compose, 'x86_64', compose.all_variants['Server-optional'], 'comps') - self.assertItemsEqual(packages, []) - self.assertItemsEqual(groups, []) - self.assertItemsEqual(filter_packages, []) + self.assertEqual(packages, set()) + self.assertEqual(groups, set()) + self.assertEqual(filter_packages, set()) @mock.patch('pungi.phases.gather.get_gather_source') def test_additional_packages(self, get_gather_source): @@ -608,9 +621,9 @@ class TestGetVariantPackages(helpers.PungiTestCase): packages, groups, filter_packages = gather.get_variant_packages( compose, 'x86_64', compose.all_variants['Server'], 'comps') - self.assertItemsEqual(packages, [('pkg', None), ('foo', 'x86_64')]) - self.assertItemsEqual(groups, []) - self.assertItemsEqual(filter_packages, []) + six.assertCountEqual(self, packages, [("pkg", None), ("foo", "x86_64")]) + self.assertEqual(groups, set()) + self.assertEqual(filter_packages, set()) @mock.patch('pungi.phases.gather.get_gather_source') def test_additional_packages_incompatible_arch(self, get_gather_source): @@ -767,7 +780,7 @@ class TestGatherPackages(helpers.PungiTestCase): variant = compose.variants["Server"] pkg_set = mock.Mock() gather.gather_packages(compose, "x86_64", variant, pkg_set), - self.assertItemsEqual( + self.assertEqual( get_variant_packages.call_args_list, [ mock.call(compose, "x86_64", variant, "comps", pkg_set) @@ -824,7 +837,8 @@ class TestGetPrepopulate(helpers.PungiTestCase): def test_for_one_variant(self): helpers.copy_fixture('prepopulate.json', os.path.join(self.topdir, 'work', 'global', 'prepopulate.json')) - self.assertItemsEqual( + six.assertCountEqual( + self, gather.get_prepopulate_packages(self.compose, 'x86_64', self.compose.variants['Server']), ["foo-common.noarch", "foo.i686", @@ -834,7 +848,8 @@ class TestGetPrepopulate(helpers.PungiTestCase): def test_for_all_variants(self): helpers.copy_fixture('prepopulate.json', os.path.join(self.topdir, 'work', 'global', 'prepopulate.json')) - self.assertItemsEqual( + six.assertCountEqual( + self, gather.get_prepopulate_packages(self.compose, 'x86_64', None), ["foo-common.noarch", "foo.i686", @@ -845,7 +860,8 @@ class TestGetPrepopulate(helpers.PungiTestCase): def test_for_all_variants_include_arch_set_to_false(self): helpers.copy_fixture('prepopulate.json', os.path.join(self.topdir, 'work', 'global', 'prepopulate.json')) - self.assertItemsEqual( + six.assertCountEqual( + self, gather.get_prepopulate_packages(self.compose, 'x86_64', None, include_arch=False), ["foo-common", @@ -875,7 +891,8 @@ class TestGatherPhase(helpers.PungiTestCase): self.assertEqual(gather_wrapper.call_args_list, [mock.call(compose, pkgset_phase.package_sets, pkgset_phase.path_prefix)]) - self.assertItemsEqual( + six.assertCountEqual( + self, link_files.call_args_list, [_mk_link_call('x86_64', 'Server'), _mk_link_call('amd64', 'Server'), @@ -943,8 +960,8 @@ class TestGetPackagesToGather(helpers.PungiTestCase): packages, groups = gather.get_packages_to_gather(self.compose) - self.assertItemsEqual(packages, ["foo", "foo2.x86_64", "pkg"]) - self.assertItemsEqual(groups, ["core"]) + six.assertCountEqual(self, packages, ["foo", "foo2.x86_64", "pkg"]) + self.assertEqual(groups, ["core"]) @mock.patch('pungi.phases.gather.get_gather_source') def test_all_include_arch_set_to_false(self, get_gather_source): @@ -954,8 +971,8 @@ class TestGetPackagesToGather(helpers.PungiTestCase): packages, groups = gather.get_packages_to_gather(self.compose, include_arch=False) - self.assertItemsEqual(packages, ["foo", "foo2", "pkg"]) - self.assertItemsEqual(groups, ["core"]) + six.assertCountEqual(self, packages, ["foo", "foo2", "pkg"]) + self.assertEqual(groups, ["core"]) @mock.patch('pungi.phases.gather.get_gather_source') def test_all_include_prepopulated(self, get_gather_source): @@ -965,10 +982,13 @@ class TestGetPackagesToGather(helpers.PungiTestCase): packages, groups = gather.get_packages_to_gather(self.compose, include_prepopulated=True) - self.assertItemsEqual(packages, ["foo", "pkg", "foo-common.noarch", - "foo.x86_64", "foo.i686", "foo2.x86_64", - "bar.x86_64"]) - self.assertItemsEqual(groups, ["core"]) + six.assertCountEqual( + self, + packages, + ["foo", "pkg", "foo-common.noarch", "foo.x86_64", "foo.i686", "foo2.x86_64", + "bar.x86_64"], + ) + self.assertEqual(groups, ["core"]) @mock.patch('pungi.phases.gather.get_gather_source') def test_all_include_prepopulated_no_include_arch(self, get_gather_source): @@ -979,9 +999,10 @@ class TestGetPackagesToGather(helpers.PungiTestCase): packages, groups = gather.get_packages_to_gather(self.compose, include_prepopulated=True, include_arch=False) - self.assertItemsEqual(packages, ["foo", "pkg", "foo-common", - "foo2", "bar"]) - self.assertItemsEqual(groups, ["core"]) + six.assertCountEqual( + self, packages, ["foo", "pkg", "foo-common", "foo2", "bar"] + ) + self.assertEqual(groups, ["core"]) @mock.patch('pungi.phases.gather.get_gather_source') def test_all_one_arch(self, get_gather_source): @@ -991,8 +1012,8 @@ class TestGetPackagesToGather(helpers.PungiTestCase): packages, groups = gather.get_packages_to_gather(self.compose, "x86_64") - self.assertItemsEqual(packages, ["foo", "pkg", "foo2.x86_64"]) - self.assertItemsEqual(groups, ["core"]) + six.assertCountEqual(self, packages, ["foo", "pkg", "foo2.x86_64"]) + self.assertEqual(groups, ["core"]) class TestUpdateConfig(unittest.TestCase): @@ -1091,10 +1112,15 @@ class TestMakeLookasideRepo(helpers.PungiTestCase): def assertCorrect(self, repopath, path_prefix, MockCR, mock_run): with open(self.pkglist) as f: packages = f.read().splitlines() - self.assertItemsEqual(packages, - ['pkg/pkg-1.0-1.x86_64.rpm', - 'pkg/pkg-debuginfo-1.0-1.x86_64.rpm', - 'pkg/pkg-1.0-1.src.rpm']) + six.assertCountEqual( + self, + packages, + [ + "pkg/pkg-1.0-1.x86_64.rpm", + "pkg/pkg-debuginfo-1.0-1.x86_64.rpm", + "pkg/pkg-1.0-1.src.rpm", + ], + ) self.assertEqual(self.repodir, repopath) self.assertEqual(MockCR.return_value.get_createrepo_cmd.call_args_list, diff --git a/tests/test_gather_source_module.py b/tests/test_gather_source_module.py index 9446bc80..7482c83c 100644 --- a/tests/test_gather_source_module.py +++ b/tests/test_gather_source_module.py @@ -6,6 +6,7 @@ except ImportError: import unittest import mock +import six import os import sys @@ -41,8 +42,8 @@ class TestGatherSourceModule(helpers.PungiTestCase): def test_without_modules(self): source = GatherSourceModule(self.compose) packages, groups = source("x86_64", self.compose.variants["Server"]) - self.assertItemsEqual(packages, []) - self.assertItemsEqual(groups, []) + self.assertEqual(packages, set()) + self.assertEqual(groups, set()) def test_include_two_packages(self): self.compose.variants["Server"].add_fake_module( @@ -57,11 +58,12 @@ class TestGatherSourceModule(helpers.PungiTestCase): source = GatherSourceModule(self.compose) packages, groups = source("x86_64", self.compose.variants["Server"]) - self.assertItemsEqual( + six.assertCountEqual( + self, [(rpm[0].nevra, rpm[1]) for rpm in packages], [("pkg-0:1.0.0-1.x86_64", None), ("pkg-0:1.0.0-1.i686", None)], ) - self.assertItemsEqual(groups, []) + self.assertEqual(groups, set()) def test_does_not_include_unlisted(self): self.compose.variants["Server"].add_fake_module( @@ -75,5 +77,5 @@ class TestGatherSourceModule(helpers.PungiTestCase): source = GatherSourceModule(self.compose) packages, groups = source("x86_64", self.compose.variants["Server"]) - self.assertItemsEqual(packages, []) - self.assertItemsEqual(groups, []) + self.assertEqual(packages, set()) + self.assertEqual(groups, set()) diff --git a/tests/test_imagebuildphase.py b/tests/test_imagebuildphase.py index d9e06def..4174fdbf 100644 --- a/tests/test_imagebuildphase.py +++ b/tests/test_imagebuildphase.py @@ -2,6 +2,8 @@ import mock +import six + import os import sys @@ -96,9 +98,11 @@ class TestImageBuildPhase(PungiTestCase): "link_type": 'hardlink-or-copy', "scratch": False, } - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, client_args)), - mock.call((compose, server_args))]) + six.assertCountEqual( + self, + phase.pool.queue_put.mock_calls, + [mock.call((compose, client_args)), mock.call((compose, server_args))], + ) @mock.patch('pungi.phases.image_build.ThreadPool') def test_image_build_phase_global_options(self, ThreadPool): @@ -155,8 +159,9 @@ class TestImageBuildPhase(PungiTestCase): "link_type": 'hardlink-or-copy', "scratch": False, } - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, server_args))]) + self.assertEqual( + phase.pool.queue_put.mock_calls, [mock.call((compose, server_args))] + ) @mock.patch('pungi.phases.image_build.ThreadPool') def test_image_build_phase_missing_version(self, ThreadPool): @@ -210,8 +215,9 @@ class TestImageBuildPhase(PungiTestCase): "link_type": 'hardlink-or-copy', "scratch": False, } - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, server_args))]) + self.assertEqual( + phase.pool.queue_put.mock_calls, [mock.call((compose, server_args))] + ) @mock.patch('pungi.phases.image_build.ThreadPool') def test_image_build_filter_all_variants(self, ThreadPool): @@ -660,8 +666,9 @@ class TestImageBuildPhase(PungiTestCase): "link_type": 'hardlink-or-copy', "scratch": False, } - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, server_args))]) + self.assertEqual( + phase.pool.queue_put.mock_calls, [mock.call((compose, server_args))] + ) @mock.patch('pungi.phases.image_build.ThreadPool') def test_failable_star(self, ThreadPool): @@ -719,8 +726,9 @@ class TestImageBuildPhase(PungiTestCase): "link_type": 'hardlink-or-copy', "scratch": False, } - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, server_args))]) + self.assertEqual( + phase.pool.queue_put.mock_calls, [mock.call((compose, server_args))] + ) class TestCreateImageBuildThread(PungiTestCase): @@ -785,20 +793,21 @@ class TestCreateImageBuildThread(PungiTestCase): with mock.patch('time.sleep'): t.process((compose, cmd), 1) - self.assertItemsEqual( + self.assertEqual( koji_wrapper.get_image_build_cmd.call_args_list, [mock.call(cmd['image_conf'], conf_file_dest='amd64,x86_64-Client-Fedora-Docker-Base-docker', scratch=False)] ) - self.assertItemsEqual( + self.assertEqual( koji_wrapper.run_blocking_cmd.call_args_list, [mock.call(koji_wrapper.get_image_build_cmd.return_value, log_file=self.topdir + '/logs/amd64-x86_64/imagebuild-Client-KDE-docker-qcow2.amd64-x86_64.log')] ) - self.assertItemsEqual( + six.assertCountEqual( + self, linker.mock_calls, [mock.call.link( '/koji/task/1235/Fedora-Docker-Base-20160103.amd64.qcow2', diff --git a/tests/test_initphase.py b/tests/test_initphase.py index c3bb7697..315e4e39 100644 --- a/tests/test_initphase.py +++ b/tests/test_initphase.py @@ -7,6 +7,8 @@ except ImportError: import unittest import mock +import six + import os import sys @@ -48,25 +50,34 @@ class TestInitPhase(PungiTestCase): self.assertEqual(write_global.mock_calls, [mock.call(compose)]) self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)]) - self.assertItemsEqual(write_arch.mock_calls, - [mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')]) - self.assertItemsEqual(create_comps.mock_calls, - [mock.call(compose, 'x86_64', None), mock.call(compose, 'amd64', None), - mock.call(compose, 'x86_64', compose.variants['Server']), - mock.call(compose, 'amd64', compose.variants['Server']), - mock.call(compose, 'amd64', compose.variants['Client']), - mock.call(compose, 'x86_64', compose.variants['Everything']), - mock.call(compose, 'amd64', compose.variants['Everything']), - mock.call(compose, 'x86_64', compose.all_variants['Server-optional'])]) - self.assertItemsEqual(write_variant.mock_calls, - [mock.call(compose, 'x86_64', compose.variants['Server']), - mock.call(compose, 'amd64', compose.variants['Server']), - mock.call(compose, 'amd64', compose.variants['Client']), - mock.call(compose, 'x86_64', compose.variants['Everything']), - mock.call(compose, 'amd64', compose.variants['Everything']), - mock.call(compose, 'x86_64', compose.all_variants['Server-optional'])]) - self.assertItemsEqual(write_defaults, []) - self.assertItemsEqual(validate_defaults, []) + six.assertCountEqual( + self, + write_arch.mock_calls, + [mock.call(compose, "x86_64"), mock.call(compose, "amd64")], + ) + six.assertCountEqual( + self, + create_comps.mock_calls, + [mock.call(compose, "x86_64", None), mock.call(compose, "amd64", None), + mock.call(compose, "x86_64", compose.variants["Server"]), + mock.call(compose, "amd64", compose.variants["Server"]), + mock.call(compose, "amd64", compose.variants["Client"]), + mock.call(compose, "x86_64", compose.variants["Everything"]), + mock.call(compose, "amd64", compose.variants["Everything"]), + mock.call(compose, "x86_64", compose.all_variants["Server-optional"])], + ) + six.assertCountEqual( + self, + write_variant.mock_calls, + [mock.call(compose, "x86_64", compose.variants["Server"]), + mock.call(compose, "amd64", compose.variants["Server"]), + mock.call(compose, "amd64", compose.variants["Client"]), + mock.call(compose, "x86_64", compose.variants["Everything"]), + mock.call(compose, "amd64", compose.variants["Everything"]), + mock.call(compose, "x86_64", compose.all_variants["Server-optional"])], + ) + self.assertEqual(write_defaults.call_args_list, []) + self.assertEqual(validate_defaults.call_args_list, []) def test_run_with_preserve( self, @@ -92,23 +103,32 @@ class TestInitPhase(PungiTestCase): validate_comps.call_args_list, [mock.call(write_global.return_value)] ) self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)]) - self.assertItemsEqual(write_arch.mock_calls, - [mock.call(compose, 'x86_64'), mock.call(compose, 'amd64')]) - self.assertItemsEqual(create_comps.mock_calls, - [mock.call(compose, 'x86_64', None), mock.call(compose, 'amd64', None), - mock.call(compose, 'x86_64', compose.variants['Server']), - mock.call(compose, 'amd64', compose.variants['Server']), - mock.call(compose, 'amd64', compose.variants['Client']), - mock.call(compose, 'x86_64', compose.variants['Everything']), - mock.call(compose, 'amd64', compose.variants['Everything'])]) - self.assertItemsEqual(write_variant.mock_calls, - [mock.call(compose, 'x86_64', compose.variants['Server']), - mock.call(compose, 'amd64', compose.variants['Server']), - mock.call(compose, 'amd64', compose.variants['Client']), - mock.call(compose, 'x86_64', compose.variants['Everything']), - mock.call(compose, 'amd64', compose.variants['Everything'])]) - self.assertItemsEqual(write_defaults, []) - self.assertItemsEqual(validate_defaults, []) + six.assertCountEqual( + self, + write_arch.mock_calls, + [mock.call(compose, "x86_64"), mock.call(compose, "amd64")], + ) + six.assertCountEqual( + self, + create_comps.mock_calls, + [mock.call(compose, "x86_64", None), mock.call(compose, "amd64", None), + mock.call(compose, "x86_64", compose.variants["Server"]), + mock.call(compose, "amd64", compose.variants["Server"]), + mock.call(compose, "amd64", compose.variants["Client"]), + mock.call(compose, "x86_64", compose.variants["Everything"]), + mock.call(compose, "amd64", compose.variants["Everything"])], + ) + six.assertCountEqual( + self, + write_variant.mock_calls, + [mock.call(compose, "x86_64", compose.variants["Server"]), + mock.call(compose, "amd64", compose.variants["Server"]), + mock.call(compose, "amd64", compose.variants["Client"]), + mock.call(compose, "x86_64", compose.variants["Everything"]), + mock.call(compose, "amd64", compose.variants["Everything"])], + ) + self.assertEqual(write_defaults.call_args_list, []) + self.assertEqual(validate_defaults.call_args_list, []) def test_run_without_comps( self, @@ -127,14 +147,14 @@ class TestInitPhase(PungiTestCase): phase = init.InitPhase(compose) phase.run() - self.assertItemsEqual(write_global.mock_calls, []) + self.assertEqual(write_global.mock_calls, []) self.assertEqual(validate_comps.call_args_list, []) - self.assertItemsEqual(write_prepopulate.mock_calls, [mock.call(compose)]) - self.assertItemsEqual(write_arch.mock_calls, []) - self.assertItemsEqual(create_comps.mock_calls, []) - self.assertItemsEqual(write_variant.mock_calls, []) - self.assertItemsEqual(write_defaults, []) - self.assertItemsEqual(validate_defaults, []) + self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)]) + self.assertEqual(write_arch.mock_calls, []) + self.assertEqual(create_comps.mock_calls, []) + self.assertEqual(write_variant.mock_calls, []) + self.assertEqual(write_defaults.call_args_list, []) + self.assertEqual(validate_defaults.call_args_list, []) def test_with_module_defaults( self, @@ -153,14 +173,14 @@ class TestInitPhase(PungiTestCase): phase = init.InitPhase(compose) phase.run() - self.assertItemsEqual(write_global.mock_calls, []) + self.assertEqual(write_global.mock_calls, []) self.assertEqual(validate_comps.call_args_list, []) - self.assertItemsEqual(write_prepopulate.mock_calls, [mock.call(compose)]) - self.assertItemsEqual(write_arch.mock_calls, []) - self.assertItemsEqual(create_comps.mock_calls, []) - self.assertItemsEqual(write_variant.mock_calls, []) - self.assertItemsEqual(write_defaults.call_args_list, [mock.call(compose)]) - self.assertItemsEqual( + self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)]) + self.assertEqual(write_arch.mock_calls, []) + self.assertEqual(create_comps.mock_calls, []) + self.assertEqual(write_variant.mock_calls, []) + self.assertEqual(write_defaults.call_args_list, [mock.call(compose)]) + self.assertEqual( validate_defaults.call_args_list, [mock.call(compose.paths.work.module_defaults_dir())], ) @@ -381,17 +401,17 @@ class TestWriteVariantComps(PungiTestCase): class TestGetLookasideGroups(PungiTestCase): def test_toplevel_variant(self): compose = DummyCompose(self.topdir, {}) - self.assertItemsEqual( - init.get_lookaside_groups(compose, compose.variants["Server"]), [] + self.assertEqual( + init.get_lookaside_groups(compose, compose.variants["Server"]), set() ) def test_classic_addon(self): compose = DummyCompose(self.topdir, {}) compose.setup_addon() compose.variants["Server"].groups = [{"name": "foo"}] - self.assertItemsEqual( + self.assertEqual( init.get_lookaside_groups(compose, compose.all_variants["Server-HA"]), - ["foo"], + set(["foo"]), ) def test_variant_as_lookaside(self): @@ -399,9 +419,9 @@ class TestGetLookasideGroups(PungiTestCase): self.topdir, {"variant_as_lookaside": [("Server", "Client")]} ) compose.variants["Client"].groups = [{"name": "foo"}] - self.assertItemsEqual( + self.assertEqual( init.get_lookaside_groups(compose, compose.variants["Server"]), - ["foo"], + set(["foo"]), ) diff --git a/tests/test_koji_wrapper.py b/tests/test_koji_wrapper.py index cd0bba2f..80282f31 100644 --- a/tests/test_koji_wrapper.py +++ b/tests/test_koji_wrapper.py @@ -11,6 +11,8 @@ import tempfile import os import sys +import six + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.wrappers.kojiwrapper import KojiWrapper, get_buildroot_rpms @@ -98,24 +100,26 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): ) self.assertEqual(cmd[:3], ['koji', '--profile=custom-koji', 'image-build']) - self.assertItemsEqual(cmd[3:], - ['--config=' + self.tmpfile, '--wait']) + six.assertCountEqual(self, cmd[3:], ["--config=" + self.tmpfile, "--wait"]) with open(self.tmpfile, 'r') as f: lines = f.read().strip().split('\n') self.assertEqual(lines[0], '[image-build]') - self.assertItemsEqual(lines[1:], - ['name = test-name', - 'version = 1', - 'target = test-target', - 'install_tree = /tmp/test/install_tree', - 'arches = x86_64', - 'format = docker,qcow2', - 'kickstart = test-kickstart', - 'ksurl = git://example.com/ks.git', - 'distro = test-distro', - 'release = 20160222.0', - 'disk_size = 4']) + six.assertCountEqual( + self, + lines[1:], + ["name = test-name", + "version = 1", + "target = test-target", + "install_tree = /tmp/test/install_tree", + "arches = x86_64", + "format = docker,qcow2", + "kickstart = test-kickstart", + "ksurl = git://example.com/ks.git", + "distro = test-distro", + "release = 20160222.0", + "disk_size = 4"], + ) def test_get_image_paths(self): @@ -276,24 +280,30 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): getTaskResult=mock.Mock(side_effect=lambda task_id: getTaskResult_data.get(task_id)) ) result = self.koji.get_image_paths(12387273) - self.assertItemsEqual(result.keys(), ['i386', 'x86_64']) + six.assertCountEqual(self, result.keys(), ["i386", "x86_64"]) self.maxDiff = None - self.assertItemsEqual(result['i386'], - ['/koji/task/12387276/tdl-i386.xml', - '/koji/task/12387276/fedora-cloud-base-2878aa0.ks', - '/koji/task/12387276/koji-f23-build-12387276-base.ks', - '/koji/task/12387276/libvirt-qcow2-i386.xml', - '/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.qcow2', - '/koji/task/12387276/libvirt-raw-xz-i386.xml', - '/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.raw.xz']) - self.assertItemsEqual(result['x86_64'], - ['/koji/task/12387277/tdl-x86_64.xml', - '/koji/task/12387277/fedora-cloud-base-2878aa0.ks', - '/koji/task/12387277/koji-f23-build-12387277-base.ks', - '/koji/task/12387277/libvirt-qcow2-x86_64.xml', - '/koji/task/12387277/Fedora-Cloud-Base-23-20160103.x86_64.qcow2', - '/koji/task/12387277/libvirt-raw-xz-x86_64.xml', - '/koji/task/12387277/Fedora-Cloud-Base-23-20160103.x86_64.raw.xz']) + six.assertCountEqual( + self, + result["i386"], + ["/koji/task/12387276/tdl-i386.xml", + "/koji/task/12387276/fedora-cloud-base-2878aa0.ks", + "/koji/task/12387276/koji-f23-build-12387276-base.ks", + "/koji/task/12387276/libvirt-qcow2-i386.xml", + "/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.qcow2", + "/koji/task/12387276/libvirt-raw-xz-i386.xml", + "/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.raw.xz"], + ) + six.assertCountEqual( + self, + result["x86_64"], + ["/koji/task/12387277/tdl-x86_64.xml", + "/koji/task/12387277/fedora-cloud-base-2878aa0.ks", + "/koji/task/12387277/koji-f23-build-12387277-base.ks", + "/koji/task/12387277/libvirt-qcow2-x86_64.xml", + "/koji/task/12387277/Fedora-Cloud-Base-23-20160103.x86_64.qcow2", + "/koji/task/12387277/libvirt-raw-xz-x86_64.xml", + "/koji/task/12387277/Fedora-Cloud-Base-23-20160103.x86_64.raw.xz"], + ) def test_get_image_paths_failed_subtask(self): @@ -316,8 +326,8 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): result = self.koji.get_image_paths(25643870, callback=failed_callback) - self.assertItemsEqual(result.keys(), ['aarch64', 'armhfp', 'x86_64']) - self.assertItemsEqual(failed, ['ppc64le', 's390x']) + six.assertCountEqual(self, result.keys(), ["aarch64", "armhfp", "x86_64"]) + six.assertCountEqual(self, failed, ["ppc64le", "s390x"]) def test_multicall_map(self): self.koji.koji_proxy = mock.Mock() @@ -327,7 +337,8 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): self.koji.koji_proxy, self.koji.koji_proxy.getBuild, ["foo", "bar"], [{"x":1}, {"x":2}]) - self.assertItemsEqual( + six.assertCountEqual( + self, self.koji.koji_proxy.getBuild.mock_calls, [mock.call("foo", x=1), mock.call("bar", x=2)]) self.koji.koji_proxy.multiCall.assert_called_with(strict=True) @@ -356,9 +367,12 @@ class LiveMediaTestCase(KojiWrapperBaseTestCase): self.assertEqual(cmd[:9], ['koji', '--profile=custom-koji', 'spin-livemedia', 'name', '1', 'tgt', 'x,y,z', 'kickstart', '--install-tree=/mnt/os']) - self.assertItemsEqual(cmd[9:], - ['--repo=repo-1', '--repo=repo-2', '--skip-tag', '--scratch', '--wait', - '--ksurl=git://example.com/ksurl.git', '--release=20160222.1']) + six.assertCountEqual( + self, + cmd[9:], + ["--repo=repo-1", "--repo=repo-2", "--skip-tag", "--scratch", "--wait", + "--ksurl=git://example.com/ksurl.git", "--release=20160222.1"], + ) class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase): @@ -366,7 +380,9 @@ class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase): cmd = self.koji.get_create_image_cmd('my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks', ['/repo/1']) self.assertEqual(cmd[0:3], ['koji', '--profile=custom-koji', 'spin-livecd']) - self.assertItemsEqual(cmd[3:7], ['--noprogress', '--scratch', '--wait', '--repo=/repo/1']) + six.assertCountEqual( + self, cmd[3:7], ["--noprogress", "--scratch", "--wait", "--repo=/repo/1"] + ) self.assertEqual(cmd[7:], ['my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks']) def test_get_create_image_cmd_full(self): @@ -376,9 +392,12 @@ class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase): ksurl='https://git.example.com/') self.assertEqual(cmd[0:3], ['koji', '--profile=custom-koji', 'spin-livecd']) self.assertEqual(cmd[-5:], ['my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks']) - self.assertItemsEqual(cmd[3:-5], - ['--noprogress', '--nowait', '--repo=/repo/1', '--repo=/repo/2', - '--release=1', '--specfile=foo.spec', '--ksurl=https://git.example.com/']) + six.assertCountEqual( + self, + cmd[3:-5], + ["--noprogress", "--nowait", "--repo=/repo/1", "--repo=/repo/2", + "--release=1", "--specfile=foo.spec", "--ksurl=https://git.example.com/"], + ) def test_spin_livecd_with_format(self): with self.assertRaises(ValueError): @@ -392,7 +411,9 @@ class LiveImageKojiWrapperTest(KojiWrapperBaseTestCase): image_type='appliance', image_format='qcow') self.assertEqual(cmd[0:3], ['koji', '--profile=custom-koji', 'spin-appliance']) - self.assertItemsEqual(cmd[3:7], ['--noprogress', '--scratch', '--wait', '--format=qcow']) + six.assertCountEqual( + self, cmd[3:7], ["--noprogress", "--scratch", "--wait", "--format=qcow"] + ) self.assertEqual(cmd[7:], ['my_name', '1.0', 'f24-candidate', 'x86_64', '/path/to/ks']) def test_spin_appliance_with_wrong_format(self): @@ -411,8 +432,7 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase): self.assertEqual(cmd[-3], 'tgt') self.assertEqual(cmd[-2], 's390x') self.assertEqual(cmd[-1], 'rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; date') - self.assertItemsEqual(cmd[3:-3], - ['--channel-override=runroot-local']) + six.assertCountEqual(self, cmd[3:-3], ["--channel-override=runroot-local"]) def test_get_cmd_full(self): cmd = self.koji.get_runroot_cmd('tgt', 's390x', ['/bin/echo', '&'], @@ -424,10 +444,13 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase): self.assertEqual(cmd[-3], 'tgt') self.assertEqual(cmd[-2], 's390x') self.assertEqual(cmd[-1], 'rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo \'&\'') - self.assertItemsEqual(cmd[3:-3], - ['--channel-override=chan', '--quiet', '--use-shell', - '--task-id', '--weight=1000', '--package=some_other_package', - '--package=lorax', '--mount=/tmp']) + six.assertCountEqual( + self, + cmd[3:-3], + ["--channel-override=chan", "--quiet", "--use-shell", + "--task-id", "--weight=1000", "--package=some_other_package", + "--package=lorax", "--mount=/tmp"], + ) @mock.patch("os.getuid", new=lambda: 1010) def test_with_chown_paths(self): @@ -443,10 +466,13 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase): cmd[-1], "rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo '&' && chmod -R a+r '/output dir' /foo && chown -R 1010 '/output dir' /foo" ) - self.assertItemsEqual(cmd[3:-3], - ['--channel-override=chan', '--quiet', '--use-shell', - '--task-id', '--weight=1000', '--package=some_other_package', - '--package=lorax', '--mount=/tmp']) + six.assertCountEqual( + self, + cmd[3:-3], + ["--channel-override=chan", "--quiet", "--use-shell", + "--task-id", "--weight=1000", "--package=some_other_package", + "--package=lorax", "--mount=/tmp"], + ) @mock.patch('pungi.wrappers.kojiwrapper.run') def test_run_runroot_cmd_no_task_id(self, run): @@ -534,9 +560,11 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): result = self.koji.run_blocking_cmd('cmd') self.assertDictEqual(result, {'retcode': 0, 'output': output, 'task_id': 1234}) - self.assertItemsEqual(run.mock_calls, - [mock.call('cmd', can_fail=True, logfile=None, env=None, - universal_newlines=True)]) + six.assertCountEqual( + self, + run.mock_calls, + [mock.call('cmd', can_fail=True, logfile=None, env=None, universal_newlines=True)], + ) @mock.patch.dict('os.environ', {'FOO': 'BAR'}, clear=True) @mock.patch('pungi.util.temp_dir') @@ -550,10 +578,13 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): result = self.koji.run_blocking_cmd('cmd') self.assertDictEqual(result, {'retcode': 0, 'output': output, 'task_id': 1234}) - self.assertItemsEqual(run.mock_calls, - [mock.call('cmd', can_fail=True, logfile=None, - env={'KRB5CCNAME': 'DIR:/tmp/foo', 'FOO': 'BAR'}, - universal_newlines=True)]) + six.assertCountEqual( + self, + run.mock_calls, + [mock.call("cmd", can_fail=True, logfile=None, + env={"KRB5CCNAME": "DIR:/tmp/foo", "FOO": "BAR"}, + universal_newlines=True)], + ) @mock.patch('pungi.wrappers.kojiwrapper.run') def test_with_log(self, run): @@ -563,9 +594,12 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): result = self.koji.run_blocking_cmd('cmd', log_file='logfile') self.assertDictEqual(result, {'retcode': 0, 'output': output, 'task_id': 1234}) - self.assertItemsEqual(run.mock_calls, - [mock.call('cmd', can_fail=True, logfile='logfile', env=None, - universal_newlines=True)]) + six.assertCountEqual( + self, + run.mock_calls, + [mock.call("cmd", can_fail=True, logfile="logfile", env=None, + universal_newlines=True)] + ) @mock.patch('pungi.wrappers.kojiwrapper.run') def test_fail_with_task_id(self, run): @@ -575,9 +609,11 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): result = self.koji.run_blocking_cmd('cmd') self.assertDictEqual(result, {'retcode': 1, 'output': output, 'task_id': 1234}) - self.assertItemsEqual(run.mock_calls, - [mock.call('cmd', can_fail=True, logfile=None, env=None, - universal_newlines=True)]) + six.assertCountEqual( + self, run.mock_calls, + [mock.call("cmd", can_fail=True, logfile=None, env=None, + universal_newlines=True)], + ) @mock.patch('pungi.wrappers.kojiwrapper.run') def test_fail_without_task_id(self, run): @@ -587,9 +623,11 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): with self.assertRaises(RuntimeError) as ctx: self.koji.run_blocking_cmd('cmd') - self.assertItemsEqual(run.mock_calls, - [mock.call('cmd', can_fail=True, logfile=None, env=None, - universal_newlines=True)]) + six.assertCountEqual( + self, run.mock_calls, + [mock.call("cmd", can_fail=True, logfile=None, env=None, + universal_newlines=True)], + ) self.assertIn('Could not find task ID', str(ctx.exception)) @mock.patch('pungi.wrappers.kojiwrapper.run') @@ -779,11 +817,15 @@ class TestGetBuildrootRPMs(unittest.TestCase): [mock.call.koji_proxy.listBuildroots(taskID=1234), mock.call.koji_proxy.listRPMs(componentBuildrootID=5458481)]) - self.assertItemsEqual(rpms, [ - 'python3-kickstart-2.25-2.fc24.noarch', - 'binutils-2.26-18.fc24.x86_64', - 'kernel-headers-4.5.2-301.fc24.x86_64' - ]) + six.assertCountEqual( + self, + rpms, + [ + "python3-kickstart-2.25-2.fc24.noarch", + "binutils-2.26-18.fc24.x86_64", + "kernel-headers-4.5.2-301.fc24.x86_64", + ], + ) @mock.patch('pungi.wrappers.kojiwrapper.run') def test_get_local(self, mock_run): @@ -793,10 +835,14 @@ class TestGetBuildrootRPMs(unittest.TestCase): rpms = get_buildroot_rpms(compose, None) - self.assertItemsEqual(rpms, [ - 'cjkuni-uming-fonts-0.2.20080216.1-56.fc23.noarch', - 'libmount-2.28-1.fc23.x86_64', - 'ed-1.10-5.fc23.x86_64', - 'kbd-2.0.2-8.fc23.x86_64', - 'coreutils-8.24-6.fc23.x86_64', - ]) + six.assertCountEqual( + self, + rpms, + [ + "cjkuni-uming-fonts-0.2.20080216.1-56.fc23.noarch", + "libmount-2.28-1.fc23.x86_64", + "ed-1.10-5.fc23.x86_64", + "kbd-2.0.2-8.fc23.x86_64", + "coreutils-8.24-6.fc23.x86_64", + ], + ) diff --git a/tests/test_liveimagesphase.py b/tests/test_liveimagesphase.py index c5150aaa..c96e6737 100644 --- a/tests/test_liveimagesphase.py +++ b/tests/test_liveimagesphase.py @@ -6,6 +6,8 @@ import mock import os import sys +import six + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases.live_images import LiveImagesPhase, CreateLiveImageThread @@ -39,34 +41,39 @@ class TestLiveImagesPhase(PungiTestCase): # assert at least one thread was started self.assertTrue(phase.pool.add.called) self.maxDiff = None - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, - {'ks_file': 'test.ks', - 'build_arch': 'amd64', - 'dest_dir': self.topdir + '/compose/Client/amd64/iso', - 'scratch': False, - 'repos': [self.topdir + '/compose/Client/amd64/os', - 'http://example.com/repo/', - self.topdir + '/compose/Everything/amd64/os', - self.topdir + '/compose/Server-optional/amd64/os'], - 'label': '', - 'name': None, - 'filename': 'image-name', - 'version': '25', - 'specfile': None, - 'sign': False, - 'type': 'live', - 'release': '20151203.t.0', - 'subvariant': 'Client', - 'failable_arches': [], - 'ksurl': None, - 'target': 'f27'}, - compose.variants['Client'], - 'amd64'))]) - self.assertItemsEqual( + six.assertCountEqual( + self, + phase.pool.queue_put.mock_calls, + [mock.call((compose, + {"ks_file": "test.ks", + "build_arch": "amd64", + "dest_dir": self.topdir + "/compose/Client/amd64/iso", + "scratch": False, + "repos": [self.topdir + "/compose/Client/amd64/os", + "http://example.com/repo/", + self.topdir + "/compose/Everything/amd64/os", + self.topdir + "/compose/Server-optional/amd64/os"], + "label": "", + "name": None, + "filename": "image-name", + "version": "25", + "specfile": None, + "sign": False, + "type": "live", + "release": "20151203.t.0", + "subvariant": "Client", + "failable_arches": [], + "ksurl": None, + "target": "f27"}, + compose.variants["Client"], + "amd64"))], + ) + six.assertCountEqual( + self, compose.get_image_name.mock_calls, - [mock.call('amd64', compose.variants['Client'], disc_num=None, disc_type='live', - format='%(compose_id)s-%(variant)s-%(arch)s-%(disc_type)s%(disc_num)s%(suffix)s')]) + [mock.call("amd64", compose.variants["Client"], disc_num=None, disc_type="live", + format="%(compose_id)s-%(variant)s-%(arch)s-%(disc_type)s%(disc_num)s%(suffix)s")] + ) @mock.patch('pungi.phases.live_images.ThreadPool') def test_live_image_build_single_repo_from(self, ThreadPool): @@ -92,29 +99,32 @@ class TestLiveImagesPhase(PungiTestCase): # assert at least one thread was started self.assertTrue(phase.pool.add.called) self.maxDiff = None - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, - {'ks_file': 'test.ks', - 'build_arch': 'amd64', - 'dest_dir': self.topdir + '/compose/Client/amd64/iso', - 'scratch': False, - 'repos': [self.topdir + '/compose/Client/amd64/os', - 'http://example.com/repo/', - self.topdir + '/compose/Everything/amd64/os'], - 'label': '', - 'name': None, - 'filename': 'image-name', - 'version': '25', - 'specfile': None, - 'sign': False, - 'type': 'live', - 'release': '20151203.t.0', - 'subvariant': 'Client', - 'failable_arches': [], - 'ksurl': None, - 'target': 'f27'}, - compose.variants['Client'], - 'amd64'))]) + six.assertCountEqual( + self, + phase.pool.queue_put.mock_calls, + [mock.call((compose, + {'ks_file': 'test.ks', + 'build_arch': 'amd64', + 'dest_dir': self.topdir + '/compose/Client/amd64/iso', + 'scratch': False, + 'repos': [self.topdir + '/compose/Client/amd64/os', + 'http://example.com/repo/', + self.topdir + '/compose/Everything/amd64/os'], + 'label': '', + 'name': None, + 'filename': 'image-name', + 'version': '25', + 'specfile': None, + 'sign': False, + 'type': 'live', + 'release': '20151203.t.0', + 'subvariant': 'Client', + 'failable_arches': [], + 'ksurl': None, + 'target': 'f27'}, + compose.variants['Client'], + 'amd64'))], + ) @mock.patch('pungi.phases.live_images.ThreadPool') def test_live_image_build_without_rename(self, ThreadPool): @@ -141,29 +151,32 @@ class TestLiveImagesPhase(PungiTestCase): # assert at least one thread was started self.assertTrue(phase.pool.add.called) self.maxDiff = None - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, - {'ks_file': 'test.ks', - 'build_arch': 'amd64', - 'dest_dir': self.topdir + '/compose/Client/amd64/iso', - 'scratch': False, - 'repos': [self.topdir + '/compose/Client/amd64/os', - 'http://example.com/repo/', - self.topdir + '/compose/Everything/amd64/os'], - 'label': '', - 'name': None, - 'filename': None, - 'version': '25', - 'specfile': None, - 'sign': False, - 'type': 'live', - 'release': '20151203.t.0', - 'subvariant': 'Client', - 'failable_arches': [], - 'ksurl': None, - 'target': 'f27'}, - compose.variants['Client'], - 'amd64'))]) + six.assertCountEqual( + self, + phase.pool.queue_put.mock_calls, + [mock.call((compose, + {'ks_file': 'test.ks', + 'build_arch': 'amd64', + 'dest_dir': self.topdir + '/compose/Client/amd64/iso', + 'scratch': False, + 'repos': [self.topdir + '/compose/Client/amd64/os', + 'http://example.com/repo/', + self.topdir + '/compose/Everything/amd64/os'], + 'label': '', + 'name': None, + 'filename': None, + 'version': '25', + 'specfile': None, + 'sign': False, + 'type': 'live', + 'release': '20151203.t.0', + 'subvariant': 'Client', + 'failable_arches': [], + 'ksurl': None, + 'target': 'f27'}, + compose.variants['Client'], + 'amd64'))], + ) @mock.patch('pungi.phases.live_images.ThreadPool') def test_live_image_build_two_images(self, ThreadPool): @@ -192,51 +205,54 @@ class TestLiveImagesPhase(PungiTestCase): # assert at least one thread was started self.assertTrue(phase.pool.add.called) self.maxDiff = None - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, - {'ks_file': 'test.ks', - 'build_arch': 'amd64', - 'dest_dir': self.topdir + '/compose/Client/amd64/iso', - 'scratch': False, - 'repos': [self.topdir + '/compose/Client/amd64/os', - 'http://example.com/repo/', - self.topdir + '/compose/Everything/amd64/os'], - 'label': '', - 'name': None, - 'filename': 'image-name', - 'version': '25', - 'specfile': None, - 'sign': False, - 'type': 'live', - 'release': None, - 'subvariant': 'Client', - 'failable_arches': [], - 'target': 'f27', - 'ksurl': None}, - compose.variants['Client'], - 'amd64')), - mock.call((compose, - {'ks_file': 'another.ks', - 'build_arch': 'amd64', - 'dest_dir': self.topdir + '/compose/Client/amd64/iso', - 'scratch': False, - 'repos': [self.topdir + '/compose/Client/amd64/os', - 'http://example.com/repo/', - self.topdir + '/compose/Everything/amd64/os'], - 'label': '', - 'name': None, - 'filename': 'image-name', - 'version': '25', - 'specfile': None, - 'sign': False, - 'type': 'live', - 'release': None, - 'subvariant': 'Client', - 'failable_arches': [], - 'target': 'f27', - 'ksurl': None}, - compose.variants['Client'], - 'amd64'))]) + six.assertCountEqual( + self, + phase.pool.queue_put.mock_calls, + [mock.call((compose, + {'ks_file': 'test.ks', + 'build_arch': 'amd64', + 'dest_dir': self.topdir + '/compose/Client/amd64/iso', + 'scratch': False, + 'repos': [self.topdir + '/compose/Client/amd64/os', + 'http://example.com/repo/', + self.topdir + '/compose/Everything/amd64/os'], + 'label': '', + 'name': None, + 'filename': 'image-name', + 'version': '25', + 'specfile': None, + 'sign': False, + 'type': 'live', + 'release': None, + 'subvariant': 'Client', + 'failable_arches': [], + 'target': 'f27', + 'ksurl': None}, + compose.variants['Client'], + 'amd64')), + mock.call((compose, + {'ks_file': 'another.ks', + 'build_arch': 'amd64', + 'dest_dir': self.topdir + '/compose/Client/amd64/iso', + 'scratch': False, + 'repos': [self.topdir + '/compose/Client/amd64/os', + 'http://example.com/repo/', + self.topdir + '/compose/Everything/amd64/os'], + 'label': '', + 'name': None, + 'filename': 'image-name', + 'version': '25', + 'specfile': None, + 'sign': False, + 'type': 'live', + 'release': None, + 'subvariant': 'Client', + 'failable_arches': [], + 'target': 'f27', + 'ksurl': None}, + compose.variants['Client'], + 'amd64'))], + ) @mock.patch('pungi.phases.live_images.ThreadPool') def test_spin_appliance(self, ThreadPool): @@ -263,29 +279,32 @@ class TestLiveImagesPhase(PungiTestCase): # assert at least one thread was started self.assertTrue(phase.pool.add.called) self.maxDiff = None - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, - {'ks_file': 'test.ks', - 'build_arch': 'amd64', - 'dest_dir': self.topdir + '/compose/Client/amd64/images', - 'scratch': False, - 'repos': [self.topdir + '/compose/Client/amd64/os', - 'http://example.com/repo/', - self.topdir + '/compose/Everything/amd64/os'], - 'label': '', - 'name': None, - 'filename': 'image-name', - 'version': '25', - 'specfile': None, - 'sign': False, - 'type': 'appliance', - 'release': None, - 'subvariant': 'Client', - 'failable_arches': [], - 'target': 'f27', - 'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'}, - compose.variants['Client'], - 'amd64'))]) + six.assertCountEqual( + self, + phase.pool.queue_put.mock_calls, + [mock.call((compose, + {'ks_file': 'test.ks', + 'build_arch': 'amd64', + 'dest_dir': self.topdir + '/compose/Client/amd64/images', + 'scratch': False, + 'repos': [self.topdir + '/compose/Client/amd64/os', + 'http://example.com/repo/', + self.topdir + '/compose/Everything/amd64/os'], + 'label': '', + 'name': None, + 'filename': 'image-name', + 'version': '25', + 'specfile': None, + 'sign': False, + 'type': 'appliance', + 'release': None, + 'subvariant': 'Client', + 'failable_arches': [], + 'target': 'f27', + 'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'}, + compose.variants['Client'], + 'amd64'))], + ) @mock.patch('pungi.phases.live_images.ThreadPool') def test_spin_appliance_phase_global_settings(self, ThreadPool): @@ -314,29 +333,32 @@ class TestLiveImagesPhase(PungiTestCase): # assert at least one thread was started self.assertTrue(phase.pool.add.called) self.maxDiff = None - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, - {'ks_file': 'test.ks', - 'build_arch': 'amd64', - 'dest_dir': self.topdir + '/compose/Client/amd64/images', - 'scratch': False, - 'repos': [self.topdir + '/compose/Client/amd64/os', - 'http://example.com/repo/', - self.topdir + '/compose/Everything/amd64/os'], - 'label': '', - 'name': None, - 'filename': 'image-name', - 'version': 'Rawhide', - 'specfile': None, - 'sign': False, - 'type': 'appliance', - 'release': '20151203.t.0', - 'subvariant': 'Client', - 'failable_arches': [], - 'target': 'f27', - 'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'}, - compose.variants['Client'], - 'amd64'))]) + six.assertCountEqual( + self, + phase.pool.queue_put.mock_calls, + [mock.call((compose, + {'ks_file': 'test.ks', + 'build_arch': 'amd64', + 'dest_dir': self.topdir + '/compose/Client/amd64/images', + 'scratch': False, + 'repos': [self.topdir + '/compose/Client/amd64/os', + 'http://example.com/repo/', + self.topdir + '/compose/Everything/amd64/os'], + 'label': '', + 'name': None, + 'filename': 'image-name', + 'version': 'Rawhide', + 'specfile': None, + 'sign': False, + 'type': 'appliance', + 'release': '20151203.t.0', + 'subvariant': 'Client', + 'failable_arches': [], + 'target': 'f27', + 'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'}, + compose.variants['Client'], + 'amd64'))], + ) @mock.patch('pungi.phases.live_images.ThreadPool') def test_spin_appliance_global_settings(self, ThreadPool): @@ -365,29 +387,32 @@ class TestLiveImagesPhase(PungiTestCase): # assert at least one thread was started self.assertTrue(phase.pool.add.called) self.maxDiff = None - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, - {'ks_file': 'test.ks', - 'build_arch': 'amd64', - 'dest_dir': self.topdir + '/compose/Client/amd64/images', - 'scratch': False, - 'repos': [self.topdir + '/compose/Client/amd64/os', - 'http://example.com/repo/', - self.topdir + '/compose/Everything/amd64/os'], - 'label': '', - 'name': None, - 'filename': 'image-name', - 'version': 'Rawhide', - 'specfile': None, - 'sign': False, - 'type': 'appliance', - 'release': '20151203.t.0', - 'subvariant': 'Client', - 'failable_arches': [], - 'target': 'f27', - 'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'}, - compose.variants['Client'], - 'amd64'))]) + six.assertCountEqual( + self, + phase.pool.queue_put.mock_calls, + [mock.call((compose, + {'ks_file': 'test.ks', + 'build_arch': 'amd64', + 'dest_dir': self.topdir + '/compose/Client/amd64/images', + 'scratch': False, + 'repos': [self.topdir + '/compose/Client/amd64/os', + 'http://example.com/repo/', + self.topdir + '/compose/Everything/amd64/os'], + 'label': '', + 'name': None, + 'filename': 'image-name', + 'version': 'Rawhide', + 'specfile': None, + 'sign': False, + 'type': 'appliance', + 'release': '20151203.t.0', + 'subvariant': 'Client', + 'failable_arches': [], + 'target': 'f27', + 'ksurl': 'https://git.example.com/kickstarts.git?#CAFEBABE'}, + compose.variants['Client'], + 'amd64'))], + ) @mock.patch('pungi.phases.live_images.ThreadPool') def test_live_image_build_custom_type(self, ThreadPool): @@ -414,33 +439,38 @@ class TestLiveImagesPhase(PungiTestCase): # assert at least one thread was started self.assertTrue(phase.pool.add.called) self.maxDiff = None - self.assertItemsEqual(phase.pool.queue_put.mock_calls, - [mock.call((compose, - {'ks_file': 'test.ks', - 'build_arch': 'amd64', - 'dest_dir': self.topdir + '/compose/Client/amd64/iso', - 'scratch': False, - 'repos': [self.topdir + '/compose/Client/amd64/os', - 'http://example.com/repo/', - self.topdir + '/compose/Everything/amd64/os'], - 'label': '', - 'name': None, - 'filename': 'image-name', - 'version': '25', - 'specfile': None, - 'sign': False, - 'type': 'live', - 'release': '20151203.t.0', - 'subvariant': 'Client', - 'failable_arches': [], - 'target': 'f27', - 'ksurl': None}, - compose.variants['Client'], - 'amd64'))]) - self.assertItemsEqual( + six.assertCountEqual( + self, + phase.pool.queue_put.mock_calls, + [mock.call((compose, + {'ks_file': 'test.ks', + 'build_arch': 'amd64', + 'dest_dir': self.topdir + '/compose/Client/amd64/iso', + 'scratch': False, + 'repos': [self.topdir + '/compose/Client/amd64/os', + 'http://example.com/repo/', + self.topdir + '/compose/Everything/amd64/os'], + 'label': '', + 'name': None, + 'filename': 'image-name', + 'version': '25', + 'specfile': None, + 'sign': False, + 'type': 'live', + 'release': '20151203.t.0', + 'subvariant': 'Client', + 'failable_arches': [], + 'target': 'f27', + 'ksurl': None}, + compose.variants['Client'], + 'amd64'))], + ) + six.assertCountEqual( + self, compose.get_image_name.mock_calls, [mock.call('amd64', compose.variants['Client'], disc_num=None, disc_type='Live', - format='%(compose_id)s-%(variant)s-%(arch)s-%(disc_type)s%(disc_num)s%(suffix)s')]) + format='%(compose_id)s-%(variant)s-%(arch)s-%(disc_type)s%(disc_num)s%(suffix)s')], + ) class TestCreateLiveImageThread(PungiTestCase): diff --git a/tests/test_livemediaphase.py b/tests/test_livemediaphase.py index 91727a33..d50bd54b 100644 --- a/tests/test_livemediaphase.py +++ b/tests/test_livemediaphase.py @@ -5,6 +5,8 @@ import mock import sys import os +import six + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases.livemedia_phase import LiveMediaPhase, LiveMediaThread @@ -480,13 +482,22 @@ class TestLiveMediaThread(PungiTestCase): self.assertTrue(os.path.isdir(self.topdir + '/compose/Server/x86_64/iso')) self.assertTrue(os.path.isdir(self.topdir + '/compose/Server/amd64/iso')) link = Linker.return_value.link - self.assertItemsEqual(link.mock_calls, - [mock.call('/koji/task/1235/Live-20160103.amd64.iso', - self.topdir + '/compose/Server/amd64/iso/Live-20160103.amd64.iso', - link_type='hardlink-or-copy'), - mock.call('/koji/task/1235/Live-20160103.x86_64.iso', - self.topdir + '/compose/Server/x86_64/iso/Live-20160103.x86_64.iso', - link_type='hardlink-or-copy')]) + six.assertCountEqual( + self, + link.mock_calls, + [ + mock.call( + "/koji/task/1235/Live-20160103.amd64.iso", + self.topdir + "/compose/Server/amd64/iso/Live-20160103.amd64.iso", + link_type="hardlink-or-copy", + ), + mock.call( + "/koji/task/1235/Live-20160103.x86_64.iso", + self.topdir + "/compose/Server/x86_64/iso/Live-20160103.x86_64.iso", + link_type="hardlink-or-copy", + ), + ], + ) image_relative_paths = [ 'Server/amd64/iso/Live-20160103.amd64.iso', diff --git a/tests/test_lorax_wrapper.py b/tests/test_lorax_wrapper.py index 078df488..85fe2566 100644 --- a/tests/test_lorax_wrapper.py +++ b/tests/test_lorax_wrapper.py @@ -8,6 +8,8 @@ except ImportError: import os import sys +import six + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.wrappers.lorax import LoraxWrapper @@ -23,12 +25,15 @@ class LoraxWrapperTest(unittest.TestCase): "/mnt/repo_baseurl", "/mnt/output_dir") self.assertEqual(cmd[0], 'lorax') - self.assertItemsEqual(cmd[1:], - ['--product=product', - '--version=version', - '--release=release', - '--source=file:///mnt/repo_baseurl', - '/mnt/output_dir']) + six.assertCountEqual( + self, + cmd[1:], + ["--product=product", + "--version=version", + "--release=release", + "--source=file:///mnt/repo_baseurl", + "/mnt/output_dir"], + ) def test_get_command_with_all_arguments(self): cmd = self.lorax.get_lorax_cmd("product", "version", "release", @@ -44,17 +49,20 @@ class LoraxWrapperTest(unittest.TestCase): log_dir='/tmp') self.assertEqual(cmd[0], 'lorax') - self.assertItemsEqual(cmd[1:], - ['--product=product', '--version=version', - '--release=release', '--variant=Server', - '--source=file:///mnt/repo_baseurl', - '--bugurl=http://example.com/', - '--buildarch=x86_64', '--volid=VOLUME_ID', - '--nomacboot', '--noupgrade', '--isfinal', - '--installpkgs=bash', '--installpkgs=vim', - '--add-template=t1', '--add-template=t2', - '--add-arch-template=ta1', '--add-arch-template=ta2', - '--add-template-var=v1', '--add-template-var=v2', - '--add-arch-template-var=va1', '--add-arch-template-var=va2', - '--logfile=/tmp/lorax.log', - '/mnt/output_dir']) + six.assertCountEqual( + self, + cmd[1:], + ["--product=product", "--version=version", + "--release=release", "--variant=Server", + "--source=file:///mnt/repo_baseurl", + "--bugurl=http://example.com/", + "--buildarch=x86_64", "--volid=VOLUME_ID", + "--nomacboot", "--noupgrade", "--isfinal", + "--installpkgs=bash", "--installpkgs=vim", + "--add-template=t1", "--add-template=t2", + "--add-arch-template=ta1", "--add-arch-template=ta2", + "--add-template-var=v1", "--add-template-var=v2", + "--add-arch-template-var=va1", "--add-arch-template-var=va2", + "--logfile=/tmp/lorax.log", + "/mnt/output_dir"], + ) diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 0330b4a7..08d82626 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -3,6 +3,8 @@ import mock import os import sys +import six + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from tests import helpers @@ -125,12 +127,17 @@ class MediaRepoTestCase(helpers.PungiTestCase): with open(self.path) as f: lines = f.read().strip().split('\n') self.assertEqual(lines[0], '[InstallMedia]') - self.assertItemsEqual(lines[1:], - ['name=Test 1.0', - 'mediaid=123456', - 'metadata_expire=-1', - 'gpgcheck=0', - 'cost=500']) + six.assertCountEqual( + self, + lines[1:], + [ + "name=Test 1.0", + "mediaid=123456", + "metadata_expire=-1", + "gpgcheck=0", + "cost=500", + ], + ) def test_addons_dont_have_media_repo(self): compose = helpers.DummyCompose(self.topdir, { diff --git a/tests/test_orchestrator.py b/tests/test_orchestrator.py index 2b07528d..0ad2c33b 100644 --- a/tests/test_orchestrator.py +++ b/tests/test_orchestrator.py @@ -211,7 +211,7 @@ class TestComposePart(PungiTestCase): def test_unblock_on(self, deps, blockers, status): part = o.ComposePart("test", "/tmp/my.conf", dependencies=deps) part.unblock_on("finished") - self.assertItemsEqual(part.blocked_on, blockers) + six.assertCountEqual(self, part.blocked_on, blockers) self.assertEqual(part.status, status) @@ -338,7 +338,8 @@ class TestCopyPart(PungiTestCase): o.copy_part(conf, linker, part) - self.assertItemsEqual( + six.assertCountEqual( + self, hd.call_args_list, [ mock.call( @@ -363,7 +364,8 @@ class TestHardlinkDir(PungiTestCase): o.hardlink_dir(linker, src, dst) - self.assertItemsEqual( + six.assertCountEqual( + self, linker.queue_put.call_args_list, [mock.call((os.path.join(src, f), os.path.join(dst, f))) for f in files], ) @@ -375,7 +377,7 @@ class TestCheckFinishedProcesses(BaseTestCase): v1 = mock.Mock() processes = {k1: v1} - self.assertItemsEqual(o.check_finished_processes(processes), []) + six.assertCountEqual(self, o.check_finished_processes(processes), []) def test_yields_finished(self): k1 = mock.Mock(returncode=None) @@ -384,14 +386,14 @@ class TestCheckFinishedProcesses(BaseTestCase): v2 = mock.Mock() processes = {k1: v1, k2: v2} - self.assertItemsEqual(o.check_finished_processes(processes), [(k2, v2)]) + six.assertCountEqual(self, o.check_finished_processes(processes), [(k2, v2)]) def test_yields_failed(self): k1 = mock.Mock(returncode=1) v1 = mock.Mock() processes = {k1: v1} - self.assertItemsEqual(o.check_finished_processes(processes), [(k1, v1)]) + six.assertCountEqual(self, o.check_finished_processes(processes), [(k1, v1)]) class _Part(object): diff --git a/tests/test_ostree_script.py b/tests/test_ostree_script.py index 1751e6b1..777e7088 100644 --- a/tests/test_ostree_script.py +++ b/tests/test_ostree_script.py @@ -6,6 +6,7 @@ import os import sys import mock +import six import yaml sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) @@ -36,7 +37,8 @@ class OstreeTreeScriptTest(helpers.PungiTestCase): '[fedora-23]\nbaseurl=why-not-zoidberg?') def assertCorrectCall(self, mock_run, extra_calls=[], extra_args=[]): - self.assertItemsEqual( + six.assertCountEqual( + self, mock_run.call_args_list, [ mock.call( @@ -344,23 +346,32 @@ class OstreeInstallerScriptTest(helpers.PungiTestCase): args.append('--add-arch-template-var=ostree_repo=http://www.example.com/ostree') ostree.main(args) self.maxDiff = None - self.assertItemsEqual(run.mock_calls, - [mock.call(['lorax', - '--product=dummyproduct', - '--version=1.0', - '--release=20160101.t.0', - '--source=http://www.example.com/dummy/repo', - '--variant=dummy', - '--nomacboot', - '--isfinal', - '--installpkgs=dummy-foo', - '--installpkgs=dummy-bar', - '--add-template=/path/to/lorax.tmpl', - '--add-arch-template=/path/to/lorax-embed.tmpl', - '--add-template-var=ostree_osname=dummy', - '--add-arch-template-var=ostree_repo=http://www.example.com/ostree', - '--rootfs-size=None', - self.output])]) + six.assertCountEqual( + self, + run.mock_calls, + [ + mock.call( + [ + "lorax", + "--product=dummyproduct", + "--version=1.0", + "--release=20160101.t.0", + "--source=http://www.example.com/dummy/repo", + "--variant=dummy", + "--nomacboot", + "--isfinal", + "--installpkgs=dummy-foo", + "--installpkgs=dummy-bar", + "--add-template=/path/to/lorax.tmpl", + "--add-arch-template=/path/to/lorax-embed.tmpl", + "--add-template-var=ostree_osname=dummy", + "--add-arch-template-var=ostree_repo=http://www.example.com/ostree", + "--rootfs-size=None", + self.output, + ], + ), + ], + ) @mock.patch('kobo.shortcuts.run') def test_run_with_extra_config_file(self, run): @@ -387,22 +398,31 @@ class OstreeInstallerScriptTest(helpers.PungiTestCase): args.append('--extra-config=%s' % extra_config_file) ostree.main(args) self.maxDiff = None - self.assertItemsEqual(run.mock_calls, - [mock.call(['lorax', - '--product=dummyproduct', - '--version=1.0', - '--release=20160101.t.0', - '--source=http://www.example.com/dummy/repo', - '--variant=dummy', - '--nomacboot', - '--isfinal', - '--installpkgs=dummy-foo', - '--installpkgs=dummy-bar', - '--add-template=/path/to/lorax.tmpl', - '--add-arch-template=/path/to/lorax-embed.tmpl', - '--add-template-var=ostree_osname=dummy-atomic', - '--add-template-var=ostree_ref=dummy/x86_64/docker', - '--add-arch-template-var=ostree_osname=dummy-atomic', - '--add-arch-template-var=ostree_repo=http://www.example.com/ostree', - '--rootfs-size=None', - self.output])]) + six.assertCountEqual( + self, + run.mock_calls, + [ + mock.call( + [ + "lorax", + "--product=dummyproduct", + "--version=1.0", + "--release=20160101.t.0", + "--source=http://www.example.com/dummy/repo", + "--variant=dummy", + "--nomacboot", + "--isfinal", + "--installpkgs=dummy-foo", + "--installpkgs=dummy-bar", + "--add-template=/path/to/lorax.tmpl", + "--add-arch-template=/path/to/lorax-embed.tmpl", + "--add-template-var=ostree_osname=dummy-atomic", + "--add-template-var=ostree_ref=dummy/x86_64/docker", + "--add-arch-template-var=ostree_osname=dummy-atomic", + "--add-arch-template-var=ostree_repo=http://www.example.com/ostree", + "--rootfs-size=None", + self.output, + ], + ), + ], + ) diff --git a/tests/test_pkgset_common.py b/tests/test_pkgset_common.py index a72fadaf..e62dfcdb 100755 --- a/tests/test_pkgset_common.py +++ b/tests/test_pkgset_common.py @@ -4,6 +4,7 @@ import os import sys import mock +import six sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) @@ -66,7 +67,9 @@ class TestMaterializedPkgsetCreate(helpers.PungiTestCase): self.compose, self.pkgset, self.prefix ) - self.assertItemsEqual(result.package_sets.keys(), ["global", "amd64", "x86_64"]) + six.assertCountEqual( + self, result.package_sets.keys(), ["global", "amd64", "x86_64"] + ) self.assertEqual(result["global"], self.pkgset) self.assertEqual(result["x86_64"], self.subsets["x86_64"]) self.assertEqual(result["amd64"], self.subsets["amd64"]) diff --git a/tests/test_pkgset_pkgsets.py b/tests/test_pkgset_pkgsets.py index a25ed302..99892e95 100644 --- a/tests/test_pkgset_pkgsets.py +++ b/tests/test_pkgset_pkgsets.py @@ -2,6 +2,7 @@ import mock import os +import six import sys try: import unittest2 as unittest @@ -125,7 +126,7 @@ class PkgsetCompareMixin(object): for k, v1 in expected.items(): self.assertIn(k, actual) v2 = actual.pop(k) - self.assertItemsEqual(v1, v2) + six.assertCountEqual(self, v1, v2) self.assertEqual({}, actual) @@ -152,7 +153,7 @@ class TestKojiPkgset(PkgsetCompareMixin, helpers.PungiTestCase): for k, v1 in expected.items(): self.assertIn(k, actual) v2 = actual.pop(k) - self.assertItemsEqual(v1, v2) + six.assertCountEqual(self, v1, v2) self.assertEqual({}, actual, msg='Some architectures were missing') def test_all_arches(self): @@ -590,5 +591,6 @@ class TestSaveFileList(unittest.TestCase): with open(self.tmpfile) as f: rpms = f.read().strip().split('\n') - self.assertItemsEqual(rpms, ['pungi@4.1.3@3.fc25@noarch', - 'pungi@4.1.3@3.fc25@src']) + six.assertCountEqual( + self, rpms, ["pungi@4.1.3@3.fc25@noarch", "pungi@4.1.3@3.fc25@src"] + ) diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py index a9d7fb3d..a121934a 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -4,6 +4,7 @@ import json import mock import os import re +import six import sys try: import unittest2 as unittest @@ -49,7 +50,8 @@ class TestGetKojiEvent(helpers.PungiTestCase): event = source_koji.get_koji_event_info(self.compose, koji_wrapper) self.assertEqual(event, EVENT_INFO) - self.assertItemsEqual( + six.assertCountEqual( + self, koji_wrapper.mock_calls, [mock.call.koji_proxy.getEvent(123456)]) with open(self.event_file) as f: @@ -64,7 +66,8 @@ class TestGetKojiEvent(helpers.PungiTestCase): event = source_koji.get_koji_event_info(self.compose, koji_wrapper) self.assertEqual(event, EVENT_INFO) - self.assertItemsEqual( + six.assertCountEqual( + self, koji_wrapper.mock_calls, [mock.call.koji_proxy.getLastEvent()]) with open(self.event_file) as f: @@ -122,12 +125,12 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase): self.assertEqual(len(pkgsets), 2) init_calls = KojiPackageSet.call_args_list - self.assertItemsEqual([call[0][0] for call in init_calls], ["f25", "f25-extra"]) - self.assertItemsEqual( - [call[0][1] for call in init_calls], [self.koji_wrapper] * 2 + six.assertCountEqual(self, [call[0][0] for call in init_calls], ["f25", "f25-extra"]) + six.assertCountEqual( + self, [call[0][1] for call in init_calls], [self.koji_wrapper] * 2 ) - self.assertItemsEqual( - [call[0][2] for call in init_calls], [["foo", "bar"]] * 2 + six.assertCountEqual( + self, [call[0][2] for call in init_calls], [["foo", "bar"]] * 2 ) pkgsets[0].assert_has_calls( @@ -159,7 +162,7 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase): pkgsets = source_koji.populate_global_pkgset( self.compose, self.koji_wrapper, '/prefix', 123456) self.assertEqual(len(pkgsets), 1) - self.assertItemsEqual(pkgsets[0].packages, ["pkg", "foo"]) + six.assertCountEqual(self, pkgsets[0].packages, ["pkg", "foo"]) class TestGetPackageSetFromKoji(helpers.PungiTestCase): @@ -179,7 +182,8 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase): self.compose, self.koji_wrapper, "/prefix" ) - self.assertItemsEqual( + six.assertCountEqual( + self, self.koji_wrapper.koji_proxy.mock_calls, [mock.call.getLastEvent()] ) @@ -382,8 +386,7 @@ class TestSourceKoji(helpers.PungiTestCase): self.assertEqual(pkgsets, gpfk.return_value) self.assertEqual(path_prefix, '/prefix/') - self.assertItemsEqual(KojiWrapper.mock_calls, - [mock.call('koji')]) + self.assertEqual(KojiWrapper.mock_calls, [mock.call('koji')]) class TestCorrectNVR(helpers.PungiTestCase): @@ -401,12 +404,12 @@ class TestCorrectNVR(helpers.PungiTestCase): def test_nv(self): module_info = source_koji.variant_dict_from_str(self.compose, self.nv) expectedKeys = ["stream", "name"] - self.assertItemsEqual(module_info.keys(), expectedKeys) + six.assertCountEqual(self, module_info.keys(), expectedKeys) def test_nvr(self): module_info = source_koji.variant_dict_from_str(self.compose, self.nvr) expectedKeys = ["stream", "name", "version"] - self.assertItemsEqual(module_info.keys(), expectedKeys) + six.assertCountEqual(self, module_info.keys(), expectedKeys) def test_correct_release(self): module_info = source_koji.variant_dict_from_str(self.compose, self.nvr) @@ -456,7 +459,7 @@ class TestFilterInherited(unittest.TestCase): result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag) - self.assertItemsEqual(result, []) + self.assertEqual(result, []) self.assertEqual( koji_proxy.mock_calls, [mock.call.getFullInheritance("top-tag", event=123456)], @@ -478,7 +481,8 @@ class TestFilterInherited(unittest.TestCase): result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag) - self.assertItemsEqual( + six.assertCountEqual( + self, result, [{"name": "foo", "version": "1", "release": "1", "tag_name": "top-tag"}], ) @@ -502,7 +506,8 @@ class TestFilterInherited(unittest.TestCase): result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag) - self.assertItemsEqual( + six.assertCountEqual( + self, result, [{"name": "foo", "version": "1", "release": "3", "tag_name": "middle-tag"}], ) @@ -546,7 +551,7 @@ class TestFilterByWhitelist(unittest.TestCase): compose, module_builds, input_modules, expected ) - self.assertItemsEqual(result, [module_builds[0], module_builds[1]]) + six.assertCountEqual(self, result, [module_builds[0], module_builds[1]]) self.assertEqual(expected, set()) def test_filter_by_NSV(self): @@ -563,7 +568,7 @@ class TestFilterByWhitelist(unittest.TestCase): compose, module_builds, input_modules, expected ) - self.assertItemsEqual(result, [module_builds[1]]) + self.assertEqual(result, [module_builds[1]]) self.assertEqual(expected, set()) def test_filter_by_NSVC(self): @@ -581,7 +586,7 @@ class TestFilterByWhitelist(unittest.TestCase): compose, module_builds, input_modules, expected ) - self.assertItemsEqual(result, [module_builds[1]]) + self.assertEqual(result, [module_builds[1]]) self.assertEqual(expected, set()) def test_filter_by_wildcard(self): @@ -598,7 +603,7 @@ class TestFilterByWhitelist(unittest.TestCase): compose, module_builds, input_modules, expected ) - self.assertItemsEqual(result, module_builds) + six.assertCountEqual(self, result, module_builds) self.assertEqual(expected, set()) diff --git a/tests/test_repoclosure_wrapper.py b/tests/test_repoclosure_wrapper.py index bb7ae950..6faa2113 100755 --- a/tests/test_repoclosure_wrapper.py +++ b/tests/test_repoclosure_wrapper.py @@ -2,6 +2,7 @@ import os import sys +import six sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) @@ -35,7 +36,8 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase): cmd = rc.get_repoclosure_cmd(arch='x86_64', repos=repos, lookaside=lookaside) self.assertEqual(cmd[0], '/usr/bin/repoclosure') - self.assertItemsEqual( + six.assertCountEqual( + self, cmd[1:], ['--arch=x86_64', '--repofrompath=my-repo,file:///mnt/koji/repo', @@ -50,7 +52,8 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase): cmd = rc.get_repoclosure_cmd(backend='dnf', arch='x86_64', repos=repos, lookaside=lookaside) self.assertEqual(cmd[:2], ['dnf', 'repoclosure']) - self.assertItemsEqual( + six.assertCountEqual( + self, cmd[2:], ['--arch=x86_64', '--repofrompath=my-repo,file:///mnt/koji/repo', @@ -66,7 +69,8 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase): } cmd = rc.get_repoclosure_cmd(repos=repos) self.assertEqual(cmd[0], '/usr/bin/repoclosure') - self.assertItemsEqual( + six.assertCountEqual( + self, cmd[1:], ['--repofrompath=local,file:///mnt/koji/repo', '--repofrompath=remote,http://kojipkgs.fp.o/repo', @@ -80,7 +84,8 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase): } cmd = rc.get_repoclosure_cmd(lookaside=repos) self.assertEqual(cmd[0], '/usr/bin/repoclosure') - self.assertItemsEqual( + six.assertCountEqual( + self, cmd[1:], ['--repofrompath=local,file:///mnt/koji/repo', '--repofrompath=remote,http://kojipkgs.fp.o/repo', diff --git a/tests/test_scm.py b/tests/test_scm.py index aa9ce7cb..81479a17 100644 --- a/tests/test_scm.py +++ b/tests/test_scm.py @@ -10,6 +10,7 @@ import tempfile import os import sys +import six sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) @@ -26,7 +27,7 @@ class SCMBaseTest(unittest.TestCase): def assertStructure(self, returned, expected): # Check we returned the correct files - self.assertItemsEqual(returned, expected) + six.assertCountEqual(self, returned, expected) # Each file must exist for f in expected: @@ -38,7 +39,7 @@ class SCMBaseTest(unittest.TestCase): for f in files: p = os.path.relpath(os.path.join(root, f), self.destdir) found.append(p) - self.assertItemsEqual(expected, found) + six.assertCountEqual(self, expected, found) class FileSCMTestCase(SCMBaseTest): @@ -269,7 +270,7 @@ class RpmSCMTestCase(SCMBaseTest): self.destdir) self.assertStructure(retval, ['some-file.txt']) - self.assertItemsEqual(self.exploded, [self.rpms[0]]) + self.assertEqual(self.exploded, set([self.rpms[0]])) @mock.patch('pungi.wrappers.scm.explode_rpm_package') def test_get_more_files(self, explode): @@ -281,7 +282,7 @@ class RpmSCMTestCase(SCMBaseTest): self.destdir) self.assertStructure(retval, ['some-file.txt', 'foo.txt']) - self.assertItemsEqual(self.exploded, [self.rpms[0]]) + self.assertEqual(self.exploded, set([self.rpms[0]])) @mock.patch('pungi.wrappers.scm.explode_rpm_package') def test_get_whole_dir(self, explode): @@ -292,7 +293,7 @@ class RpmSCMTestCase(SCMBaseTest): self.destdir) self.assertStructure(retval, ['subdir/foo.txt', 'subdir/bar.txt']) - self.assertItemsEqual(self.exploded, [self.rpms[0]]) + self.assertEqual(self.exploded, set([self.rpms[0]])) @mock.patch('pungi.wrappers.scm.explode_rpm_package') def test_get_dir_contents(self, explode): @@ -303,7 +304,7 @@ class RpmSCMTestCase(SCMBaseTest): self.destdir) self.assertStructure(retval, ['foo.txt', 'bar.txt']) - self.assertItemsEqual(self.exploded, [self.rpms[0]]) + self.assertEqual(self.exploded, set([self.rpms[0]])) @mock.patch('pungi.wrappers.scm.explode_rpm_package') def test_get_files_from_two_rpms(self, explode): @@ -315,7 +316,7 @@ class RpmSCMTestCase(SCMBaseTest): self.destdir) self.assertStructure(retval, ['some-file-1.txt', 'some-file-2.txt']) - self.assertItemsEqual(self.exploded, self.rpms) + six.assertCountEqual(self, self.exploded, self.rpms) @mock.patch('pungi.wrappers.scm.explode_rpm_package') def test_get_files_from_glob_rpms(self, explode): @@ -328,7 +329,7 @@ class RpmSCMTestCase(SCMBaseTest): self.assertStructure(retval, ['some-file-1.txt', 'some-file-2.txt', 'some-file-3.txt', 'some-file-4.txt']) - self.assertItemsEqual(self.exploded, self.numbered) + six.assertCountEqual(self, self.exploded, self.numbered) @mock.patch('pungi.wrappers.scm.explode_rpm_package') def test_get_dir_from_two_rpms(self, explode): @@ -340,7 +341,7 @@ class RpmSCMTestCase(SCMBaseTest): self.destdir) self.assertStructure(retval, ['common/foo-1.txt', 'common/foo-2.txt']) - self.assertItemsEqual(self.exploded, self.rpms) + six.assertCountEqual(self, self.exploded, self.rpms) @mock.patch('pungi.wrappers.scm.explode_rpm_package') def test_get_dir_from_glob_rpms(self, explode): @@ -353,7 +354,7 @@ class RpmSCMTestCase(SCMBaseTest): self.assertStructure(retval, ['foo-1.txt', 'foo-2.txt', 'foo-3.txt', 'foo-4.txt']) - self.assertItemsEqual(self.exploded, self.numbered) + six.assertCountEqual(self, self.exploded, self.numbered) class CvsSCMTestCase(SCMBaseTest): diff --git a/tests/test_test_phase.py b/tests/test_test_phase.py index e6d8eafc..6d851a06 100644 --- a/tests/test_test_phase.py +++ b/tests/test_test_phase.py @@ -8,6 +8,7 @@ except ImportError: import mock import os +import six import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) @@ -325,7 +326,8 @@ class TestRepoclosure(PungiTestCase): test_phase.run_repoclosure(compose) - self.assertItemsEqual( + six.assertCountEqual( + self, mock_grc.call_args_list, [mock.call(backend='yum', arch=['amd64', 'x86_64', 'noarch'], lookaside={}, repos=self._get_repo(compose.compose_id, 'Everything', 'amd64')), @@ -345,7 +347,8 @@ class TestRepoclosure(PungiTestCase): compose = DummyCompose(self.topdir, {'repoclosure_backend': 'dnf'}) test_phase.run_repoclosure(compose) - self.assertItemsEqual( + six.assertCountEqual( + self, mock_grc.call_args_list, [mock.call(backend='dnf', arch=['amd64', 'x86_64', 'noarch'], lookaside={}, repos=self._get_repo(compose.compose_id, 'Everything', 'amd64')), @@ -375,7 +378,8 @@ class TestRepoclosure(PungiTestCase): test_phase.run_repoclosure(compose) self.assertEqual(mock_grc.call_args_list, []) - self.assertItemsEqual( + six.assertCountEqual( + self, effl.call_args_list, [ mock.call(f, _log("amd64", "Everything")), @@ -410,7 +414,8 @@ class TestRepoclosure(PungiTestCase): }) test_phase.run_repoclosure(compose) - self.assertItemsEqual( + six.assertCountEqual( + self, mock_grc.call_args_list, [mock.call(backend='dnf', arch=['amd64', 'x86_64', 'noarch'], lookaside={}, repos=self._get_repo(compose.compose_id, 'Server', 'amd64')), diff --git a/tests/test_unified_isos.py b/tests/test_unified_isos.py index 966f2f21..800fd9c4 100755 --- a/tests/test_unified_isos.py +++ b/tests/test_unified_isos.py @@ -4,6 +4,7 @@ import mock import os import shutil import sys +import six from six.moves.configparser import SafeConfigParser sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) @@ -147,9 +148,11 @@ class TestLinkToTemp(PungiTestCase): def test_link_to_temp(self): self.isos.link_to_temp() - self.assertItemsEqual(self.isos.treeinfo.keys(), - ['i386', 's390x', 'src', 'x86_64', - 'debug-i386', 'debug-s390x', 'debug-x86_64']) + six.assertCountEqual( + self, + self.isos.treeinfo.keys(), + ["i386", "s390x", "src", "x86_64", "debug-i386", "debug-s390x", "debug-x86_64"], + ) self.assertEqual(self.isos.comps, get_comps_mapping(self.compose_path)) self.assertEqual(self.isos.productid, @@ -157,7 +160,8 @@ class TestLinkToTemp(PungiTestCase): self.assertEqual(self.isos.repos, get_repos_mapping(self.isos.temp_dir)) - self.assertItemsEqual( + six.assertCountEqual( + self, self.isos.linker.link.call_args_list, [self._linkCall('Server', 's390x', 'dummy-filesystem-4.2.37-6.s390x.rpm'), self._linkCall('Server', 's390x', 'dummy-elinks-debuginfo-2.6-2.s390x.rpm'), @@ -178,9 +182,11 @@ class TestLinkToTemp(PungiTestCase): with mock.patch('sys.stderr'): self.isos.link_to_temp() - self.assertItemsEqual(self.isos.treeinfo.keys(), - ['s390x', 'src', 'x86_64', - 'debug-s390x', 'debug-x86_64']) + six.assertCountEqual( + self, + self.isos.treeinfo.keys(), + ["s390x", "src", "x86_64", "debug-s390x", "debug-x86_64"], + ) comps = get_comps_mapping(self.compose_path) comps.pop('i386') self.assertEqual(self.isos.comps, comps) @@ -194,7 +200,8 @@ class TestLinkToTemp(PungiTestCase): self.maxDiff = None - self.assertItemsEqual( + six.assertCountEqual( + self, self.isos.linker.link.call_args_list, [self._linkCall('Server', 's390x', 'dummy-filesystem-4.2.37-6.s390x.rpm'), self._linkCall('Server', 's390x', 'dummy-elinks-debuginfo-2.6-2.s390x.rpm'), @@ -211,9 +218,11 @@ class TestLinkToTemp(PungiTestCase): self.isos.link_to_temp() - self.assertItemsEqual(self.isos.treeinfo.keys(), - ['i386', 's390x', 'src', 'x86_64', - 'debug-i386', 'debug-s390x', 'debug-x86_64']) + six.assertCountEqual( + self, + self.isos.treeinfo.keys(), + ["i386", "s390x", "src", "x86_64", "debug-i386", "debug-s390x", "debug-x86_64"], + ) self.assertEqual(self.isos.comps, get_comps_mapping(self.compose_path)) self.assertEqual(self.isos.productid, @@ -221,7 +230,8 @@ class TestLinkToTemp(PungiTestCase): self.assertEqual(self.isos.repos, get_repos_mapping(self.isos.temp_dir)) - self.assertItemsEqual( + six.assertCountEqual( + self, self.isos.linker.link.call_args_list, [self._linkCall('Server', 's390x', 'dummy-filesystem-4.2.37-6.s390x.rpm'), self._linkCall('Server', 's390x', 'dummy-elinks-debuginfo-2.6-2.s390x.rpm'), @@ -267,7 +277,8 @@ class TestCreaterepo(PungiTestCase): cr.return_value.get_createrepo_cmd.side_effect = self.mock_cr self.isos.createrepo() - self.assertItemsEqual( + six.assertCountEqual( + self, run.call_args_list, [mock.call(('src/Client', None), show_cmd=True), mock.call(('src/Server', None), show_cmd=True), @@ -311,7 +322,8 @@ class TestCreaterepo(PungiTestCase): cr.return_value.get_modifyrepo_cmd.side_effect = self.mock_mr self.isos.createrepo() - self.assertItemsEqual( + six.assertCountEqual( + self, run.call_args_list, [mock.call(('src/Client', None), show_cmd=True), mock.call(('src/Server', None), show_cmd=True), @@ -369,7 +381,8 @@ class TestDiscinfo(PungiTestCase): @mock.patch('pungi_utils.unified_isos.create_discinfo') def test_discinfo(self, create_discinfo): self.isos.discinfo() - self.assertItemsEqual( + six.assertCountEqual( + self, create_discinfo.call_args_list, [mock.call(os.path.join(self.isos.temp_dir, 'trees', 'i386', '.discinfo'), 'Dummy Product 1.0', 'i386'), @@ -465,7 +478,7 @@ class TestCreateiso(PungiTestCase): mock.call(self.debug, self._iso('Server', 'x86_64/debug', self.debug_fn)), mock.call(self.debug + '.manifest', self._iso('Server', 'x86_64/debug', self.debug_fn + '.manifest')), ]) - self.assertItemsEqual(self.isos.linker.link.call_args_list, expected) + six.assertCountEqual(self, self.isos.linker.link.call_args_list, expected) @mock.patch('pungi_utils.unified_isos.iso') @mock.patch('pungi_utils.unified_isos.run') @@ -525,7 +538,8 @@ class TestUpdateChecksums(PungiTestCase): @mock.patch('pungi_utils.unified_isos.make_checksums') def test_update_checksums(self, mmc): self.isos.update_checksums() - self.assertItemsEqual( + six.assertCountEqual( + self, mmc.call_args_list, [mock.call(self.compose_path, self.isos.compose.images, unified_isos.DEFAULT_CHECKSUMS, False, @@ -535,7 +549,8 @@ class TestUpdateChecksums(PungiTestCase): def test_update_checksums_one_file(self, mmc): self.isos.conf['media_checksum_one_file'] = True self.isos.update_checksums() - self.assertItemsEqual( + six.assertCountEqual( + self, mmc.call_args_list, [mock.call(self.compose_path, self.isos.compose.images, unified_isos.DEFAULT_CHECKSUMS, True, diff --git a/tests/test_util.py b/tests/test_util.py index 92dc3c68..6a746156 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -11,6 +11,7 @@ except ImportError: import tempfile import shutil import subprocess +import six sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) @@ -224,7 +225,7 @@ class TestGetVariantData(unittest.TestCase): } } result = util.get_variant_data(conf, 'foo', mock.Mock(uid='Client')) - self.assertItemsEqual(result, [1, 2, 3]) + six.assertCountEqual(self, result, [1, 2, 3]) def test_not_matching_arch(self): conf = { @@ -233,11 +234,11 @@ class TestGetVariantData(unittest.TestCase): } } result = util.get_variant_data(conf, 'foo', mock.Mock(uid='Server')) - self.assertItemsEqual(result, []) + self.assertEqual(result, []) def test_handle_missing_config(self): result = util.get_variant_data({}, 'foo', mock.Mock(uid='Client')) - self.assertItemsEqual(result, []) + self.assertEqual(result, []) def test_get_save_pattern(self): conf = {