From 4ff13b1993d6ab79d6683007437eb4e8f2398416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Fri, 22 Nov 2024 15:44:16 +0200 Subject: [PATCH] Drop usage of six MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We no longer need to support Python 2, so there's no point in this compatibility layer. Signed-off-by: Lubomír Sedlář (cherry picked from commit b34de57813187f1781aef733468c9745a144d9af) --- pungi/checks.py | 7 +- pungi/createiso.py | 9 +- pungi/ostree/container.py | 7 +- pungi/phases/buildinstall.py | 18 +- pungi/phases/createiso.py | 4 +- pungi/phases/gather/__init__.py | 2 +- pungi/phases/gather/methods/method_nodeps.py | 3 +- pungi/phases/osbs.py | 2 +- pungi/phases/ostree_installer.py | 6 +- pungi/phases/pkgset/pkgsets.py | 2 +- pungi/runroot.py | 7 +- pungi/scripts/config_dump.py | 3 +- pungi/scripts/config_validate.py | 4 +- pungi/scripts/pungi_koji.py | 5 +- pungi/util.py | 8 +- pungi/wrappers/iso.py | 10 +- pungi/wrappers/kojiwrapper.py | 18 +- pungi/wrappers/scm.py | 13 +- pungi_utils/patch_iso.py | 4 +- setup.py | 1 - tests/helpers.py | 8 +- tests/test_arguments.py | 12 +- tests/test_buildinstall.py | 74 ++- tests/test_checks.py | 2 +- tests/test_compose.py | 23 +- tests/test_config.py | 27 +- tests/test_config_validate_script.py | 16 +- tests/test_createiso_phase.py | 22 +- tests/test_createiso_script.py | 2 +- tests/test_createrepo_wrapper.py | 15 +- tests/test_createrepophase.py | 17 +- tests/test_extra_files_phase.py | 5 +- tests/test_extra_isos_phase.py | 31 +- tests/test_fus_wrapper.py | 5 +- tests/test_gather.py | 446 +++++++------------ tests/test_gather_method_hybrid.py | 17 +- tests/test_gather_method_nodeps.py | 5 +- tests/test_gather_phase.py | 60 +-- tests/test_gather_source_module.py | 9 +- tests/test_imagebuildphase.py | 8 +- tests/test_initphase.py | 20 +- tests/test_iso_wrapper.py | 3 +- tests/test_koji_wrapper.py | 54 +-- tests/test_livemediaphase.py | 5 +- tests/test_lorax_wrapper.py | 8 +- tests/test_metadata.py | 11 +- tests/test_ostree_installer_phase.py | 4 +- tests/test_ostree_script.py | 15 +- tests/test_pkgset_common.py | 10 +- tests/test_pkgset_pkgsets.py | 9 +- tests/test_pkgset_source_koji.py | 41 +- tests/test_repoclosure_phase.py | 10 +- tests/test_repoclosure_wrapper.py | 7 +- tests/test_scm.py | 14 +- tests/test_unified_isos.py | 38 +- tests/test_util.py | 5 +- tests/test_variant_wrapper.py | 4 +- 57 files changed, 450 insertions(+), 745 deletions(-) diff --git a/pungi/checks.py b/pungi/checks.py index 08426bdd..23974d07 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -42,7 +42,6 @@ import platform import re import jsonschema -import six from kobo.shortcuts import force_list from pungi.phases import PHASES_NAMES from pungi.runroot import RUNROOT_TYPES @@ -236,8 +235,8 @@ def validate(config, offline=False, schema=None): schema, { "array": (tuple, list), - "regex": six.string_types, - "url": six.string_types, + "regex": str, + "url": str, }, ) errors = [] @@ -462,7 +461,7 @@ def _extend_with_default_and_alias(validator_class, offline=False): return isinstance(instance, (tuple, list)) def is_string_type(checker, instance): - return isinstance(instance, six.string_types) + return isinstance(instance, str) kwargs["type_checker"] = validator_class.TYPE_CHECKER.redefine_many( {"array": is_array, "regex": is_string_type, "url": is_string_type} diff --git a/pungi/createiso.py b/pungi/createiso.py index e68932eb..c5352a65 100644 --- a/pungi/createiso.py +++ b/pungi/createiso.py @@ -3,10 +3,9 @@ from __future__ import print_function import os -import six +import shlex from collections import namedtuple from kobo.shortcuts import run -from six.moves import shlex_quote from .wrappers import iso from .wrappers.jigdo import JigdoWrapper @@ -41,13 +40,13 @@ def quote(str): expanded. """ if str.startswith("$TEMPLATE"): - return "$TEMPLATE%s" % shlex_quote(str.replace("$TEMPLATE", "", 1)) - return shlex_quote(str) + return "$TEMPLATE%s" % shlex.quote(str.replace("$TEMPLATE", "", 1)) + return shlex.quote(str) def emit(f, cmd): """Print line of shell code into the stream.""" - if isinstance(cmd, six.string_types): + if isinstance(cmd, str): print(cmd, file=f) else: print(" ".join([quote(x) for x in cmd]), file=f) diff --git a/pungi/ostree/container.py b/pungi/ostree/container.py index 7a552655..78ad0126 100644 --- a/pungi/ostree/container.py +++ b/pungi/ostree/container.py @@ -16,8 +16,7 @@ import os import json -import six -from six.moves import shlex_quote +import shlex from .base import OSTree @@ -26,10 +25,10 @@ from .utils import tweak_treeconf def emit(cmd): """Print line of shell code into the stream.""" - if isinstance(cmd, six.string_types): + if isinstance(cmd, str): print(cmd) else: - print(" ".join([shlex_quote(x) for x in cmd])) + print(" ".join([shlex.quote(x) for x in cmd])) class Container(OSTree): diff --git a/pungi/phases/buildinstall.py b/pungi/phases/buildinstall.py index c315e057..2ba30000 100644 --- a/pungi/phases/buildinstall.py +++ b/pungi/phases/buildinstall.py @@ -16,17 +16,17 @@ import errno import os +import pickle import time +import shlex import shutil import re -from six.moves import cPickle as pickle from copy import copy from kobo.threads import ThreadPool, WorkerThread from kobo.shortcuts import run, force_list import kobo.rpmlib from productmd.images import Image -from six.moves import shlex_quote from pungi.arch import get_valid_arches from pungi.util import get_volid, get_arch_variant_data @@ -207,8 +207,8 @@ class BuildinstallPhase(PhaseBase): configuration_file=configuration_file, ) return "rm -rf %s && %s" % ( - shlex_quote(output_topdir), - " ".join([shlex_quote(x) for x in lorax_cmd]), + shlex.quote(output_topdir), + " ".join([shlex.quote(x) for x in lorax_cmd]), ) def get_repos(self, arch): @@ -413,8 +413,8 @@ def tweak_buildinstall( # copy src to temp # TODO: place temp on the same device as buildinstall dir so we can hardlink cmd = "cp -dRv --preserve=mode,links,timestamps --remove-destination %s/* %s/" % ( - shlex_quote(src), - shlex_quote(tmp_dir), + shlex.quote(src), + shlex.quote(tmp_dir), ) run(cmd) @@ -452,12 +452,12 @@ def tweak_buildinstall( run(cmd) # HACK: make buildinstall files world readable - run("chmod -R a+rX %s" % shlex_quote(tmp_dir)) + run("chmod -R a+rX %s" % shlex.quote(tmp_dir)) # copy temp to dst cmd = "cp -dRv --preserve=mode,links,timestamps --remove-destination %s/* %s/" % ( - shlex_quote(tmp_dir), - shlex_quote(dst), + shlex.quote(tmp_dir), + shlex.quote(dst), ) run(cmd) diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py index d4970e5f..a202d32b 100644 --- a/pungi/phases/createiso.py +++ b/pungi/phases/createiso.py @@ -17,6 +17,7 @@ import itertools import os import random +import shlex import shutil import stat import json @@ -25,7 +26,6 @@ import productmd.treeinfo from productmd.images import Image from kobo.threads import ThreadPool, WorkerThread from kobo.shortcuts import run, relative_path, compute_file_checksums -from six.moves import shlex_quote from pungi.wrappers import iso from pungi.wrappers.createrepo import CreaterepoWrapper @@ -782,7 +782,7 @@ def prepare_iso( if file_list_content: # write modified repodata only if there are packages available - run("cp -a %s/repodata %s/" % (shlex_quote(tree_dir), shlex_quote(iso_dir))) + run("cp -a %s/repodata %s/" % (shlex.quote(tree_dir), shlex.quote(iso_dir))) with open(file_list, "w") as f: f.write("\n".join(file_list_content)) cmd = repo.get_createrepo_cmd( diff --git a/pungi/phases/gather/__init__.py b/pungi/phases/gather/__init__.py index f4d48a91..c7f6c1a8 100644 --- a/pungi/phases/gather/__init__.py +++ b/pungi/phases/gather/__init__.py @@ -17,6 +17,7 @@ import glob import json import os +import pickle import shutil import threading @@ -24,7 +25,6 @@ from kobo.rpmlib import parse_nvra from kobo.shortcuts import run from productmd.rpms import Rpms from pungi.phases.pkgset.common import get_all_arches -from six.moves import cPickle as pickle try: from queue import Queue diff --git a/pungi/phases/gather/methods/method_nodeps.py b/pungi/phases/gather/methods/method_nodeps.py index 062a386b..6b5b6b96 100644 --- a/pungi/phases/gather/methods/method_nodeps.py +++ b/pungi/phases/gather/methods/method_nodeps.py @@ -16,7 +16,6 @@ import os from pprint import pformat import re -import six import pungi.arch from pungi.util import pkg_is_rpm, pkg_is_srpm, pkg_is_debug @@ -74,7 +73,7 @@ class GatherMethodNodeps(pungi.phases.gather.method.GatherMethodBase): if not pkg_is_rpm(pkg): continue for gathered_pkg, pkg_arch in packages: - if isinstance(gathered_pkg, six.string_types) and not re.match( + if isinstance(gathered_pkg, str) and not re.match( gathered_pkg.replace(".", "\\.") .replace("+", "\\+") .replace("*", ".*") diff --git a/pungi/phases/osbs.py b/pungi/phases/osbs.py index 9463ffae..bcf5e6f0 100644 --- a/pungi/phases/osbs.py +++ b/pungi/phases/osbs.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import configparser import copy import fnmatch import json @@ -7,7 +8,6 @@ import os from kobo.threads import ThreadPool, WorkerThread from kobo import shortcuts from productmd.rpms import Rpms -from six.moves import configparser from .base import ConfigGuardedPhase, PhaseLoggerMixin from .. import util diff --git a/pungi/phases/ostree_installer.py b/pungi/phases/ostree_installer.py index 8e9a1f6e..771d3cd4 100644 --- a/pungi/phases/ostree_installer.py +++ b/pungi/phases/ostree_installer.py @@ -2,9 +2,9 @@ import os from kobo.threads import ThreadPool, WorkerThread +import shlex import shutil from productmd import images -from six.moves import shlex_quote from kobo import shortcuts from .base import ConfigGuardedPhase, PhaseLoggerMixin @@ -275,8 +275,8 @@ class OstreeInstallerThread(WorkerThread): skip_branding=config.get("skip_branding"), ) cmd = "rm -rf %s && %s" % ( - shlex_quote(output_dir), - " ".join([shlex_quote(x) for x in lorax_cmd]), + shlex.quote(output_dir), + " ".join([shlex.quote(x) for x in lorax_cmd]), ) runroot.run( diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index 66e45dec..1a052293 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -22,10 +22,10 @@ It automatically finds a signed copies according to *sigkey_ordering*. import itertools import json import os +import pickle import time import pgpy import rpm -from six.moves import cPickle as pickle from functools import partial import kobo.log diff --git a/pungi/runroot.py b/pungi/runroot.py index 26bc6fec..ea924d23 100644 --- a/pungi/runroot.py +++ b/pungi/runroot.py @@ -16,12 +16,11 @@ import contextlib import os import re +import shlex import shutil import tarfile import requests -import six -from six.moves import shlex_quote import kobo.log from kobo.shortcuts import run @@ -157,7 +156,7 @@ class Runroot(kobo.log.LoggingBase): formatted_cmd = command.format(**fmt_dict) if fmt_dict else command ssh_cmd = ["ssh", "-oBatchMode=yes", "-n", "-l", user, hostname, formatted_cmd] output = run(ssh_cmd, show_cmd=True, logfile=log_file)[1] - if six.PY3 and isinstance(output, bytes): + if isinstance(output, bytes): return output.decode() else: return output @@ -184,7 +183,7 @@ class Runroot(kobo.log.LoggingBase): # If the output dir is defined, change the permissions of files generated # by the runroot task, so the Pungi user can access them. if chown_paths: - paths = " ".join(shlex_quote(pth) for pth in chown_paths) + paths = " ".join(shlex.quote(pth) for pth in chown_paths) command += " ; EXIT_CODE=$?" # Make the files world readable command += " ; chmod -R a+r %s" % paths diff --git a/pungi/scripts/config_dump.py b/pungi/scripts/config_dump.py index c53ac5ea..d0c8c647 100644 --- a/pungi/scripts/config_dump.py +++ b/pungi/scripts/config_dump.py @@ -4,13 +4,12 @@ from __future__ import absolute_import from __future__ import print_function import argparse +import configparser import json import os import shutil import sys -from six.moves import configparser - import kobo.conf import pungi.checks import pungi.util diff --git a/pungi/scripts/config_validate.py b/pungi/scripts/config_validate.py index 8d47ff29..1aa289cd 100644 --- a/pungi/scripts/config_validate.py +++ b/pungi/scripts/config_validate.py @@ -8,8 +8,6 @@ import json import os import sys -import six - import pungi.checks import pungi.compose import pungi.paths @@ -56,7 +54,7 @@ class ValidationCompose(pungi.compose.Compose): def read_variants(compose, config): with pungi.util.temp_dir() as tmp_dir: scm_dict = compose.conf["variants_file"] - if isinstance(scm_dict, six.string_types) and scm_dict[0] != "/": + if isinstance(scm_dict, str) and scm_dict[0] != "/": config_dir = os.path.dirname(config) scm_dict = os.path.join(config_dir, scm_dict) files = pungi.wrappers.scm.get_file_from_scm(scm_dict, tmp_dir) diff --git a/pungi/scripts/pungi_koji.py b/pungi/scripts/pungi_koji.py index 078844a7..5e51e2a9 100644 --- a/pungi/scripts/pungi_koji.py +++ b/pungi/scripts/pungi_koji.py @@ -11,14 +11,13 @@ import locale import logging import os import socket +import shlex import signal import sys import traceback import shutil import subprocess -from six.moves import shlex_quote - from pungi.phases import PHASES_NAMES from pungi import get_full_version, util from pungi.errors import UnsignedPackagesError @@ -386,7 +385,7 @@ def run_compose( compose.log_info("User name: %s" % getpass.getuser()) compose.log_info("Working directory: %s" % os.getcwd()) compose.log_info( - "Command line: %s" % " ".join([shlex_quote(arg) for arg in sys.argv]) + "Command line: %s" % " ".join([shlex.quote(arg) for arg in sys.argv]) ) compose.log_info("Compose top directory: %s" % compose.topdir) compose.log_info("Current timezone offset: %s" % pungi.util.get_tz_offset()) diff --git a/pungi/util.py b/pungi/util.py index 4ed9758b..7dccbc99 100644 --- a/pungi/util.py +++ b/pungi/util.py @@ -24,11 +24,13 @@ import hashlib import errno import re import contextlib +import shlex import traceback import tempfile import time +import urllib.parse +import urllib.request import functools -from six.moves import urllib, range, shlex_quote import kobo.conf from kobo.shortcuts import run, force_list @@ -193,14 +195,14 @@ def explode_rpm_package(pkg_path, target_dir): try: # rpm2archive writes to stdout only if reading from stdin, thus the redirect run( - "rpm2archive - <%s | tar xfz - && chmod -R a+rX ." % shlex_quote(pkg_path), + "rpm2archive - <%s | tar xfz - && chmod -R a+rX ." % shlex.quote(pkg_path), workdir=target_dir, ) except RuntimeError: # Fall back to rpm2cpio in case rpm2archive failed (most likely due to # not being present on the system). run( - "rpm2cpio %s | cpio -iuvmd && chmod -R a+rX ." % shlex_quote(pkg_path), + "rpm2cpio %s | cpio -iuvmd && chmod -R a+rX ." % shlex.quote(pkg_path), workdir=target_dir, ) diff --git a/pungi/wrappers/iso.py b/pungi/wrappers/iso.py index 1f017b7c..5a2533f8 100644 --- a/pungi/wrappers/iso.py +++ b/pungi/wrappers/iso.py @@ -15,9 +15,9 @@ import os +import shlex from fnmatch import fnmatch import contextlib -from six.moves import shlex_quote from kobo.shortcuts import force_list, relative_path, run from pungi import util @@ -270,13 +270,13 @@ def get_manifest_cmd(iso_name, xorriso=False, output_file=None): tr -d "'" | cut -c2- | sort >> %s""" % ( - shlex_quote(iso_name), - shlex_quote(output_file), + shlex.quote(iso_name), + shlex.quote(output_file), ) else: return "isoinfo -R -f -i %s | grep -v '/TRANS.TBL$' | sort >> %s" % ( - shlex_quote(iso_name), - shlex_quote(output_file), + shlex.quote(iso_name), + shlex.quote(output_file), ) diff --git a/pungi/wrappers/kojiwrapper.py b/pungi/wrappers/kojiwrapper.py index a6a30c28..8419cbed 100644 --- a/pungi/wrappers/kojiwrapper.py +++ b/pungi/wrappers/kojiwrapper.py @@ -14,21 +14,21 @@ # along with this program; if not, see . +import configparser import contextlib import os import re import socket +import shlex import shutil import time import threading +import xmlrpc.client import requests import koji from kobo.shortcuts import run, force_list -import six -from six.moves import configparser, shlex_quote -import six.moves.xmlrpc_client as xmlrpclib from flufl.lock import Lock from datetime import timedelta @@ -74,7 +74,7 @@ class KojiWrapper(object): # This retry should be removed once https://pagure.io/koji/issue/3170 is # fixed and released. - @util.retry(wait_on=(xmlrpclib.ProtocolError, koji.GenericError)) + @util.retry(wait_on=(xmlrpc.client.ProtocolError, koji.GenericError)) def login(self): """Authenticate to the hub.""" auth_type = self.koji_module.config.authtype @@ -145,7 +145,7 @@ class KojiWrapper(object): cmd.append(arch) if isinstance(command, list): - command = " ".join([shlex_quote(i) for i in command]) + command = " ".join([shlex.quote(i) for i in command]) # HACK: remove rpmdb and yum cache command = ( @@ -153,7 +153,7 @@ class KojiWrapper(object): ) if chown_paths: - paths = " ".join(shlex_quote(pth) for pth in chown_paths) + paths = " ".join(shlex.quote(pth) for pth in chown_paths) command += " ; EXIT_CODE=$?" # Make the files world readable command += " ; chmod -R a+r %s" % paths @@ -359,7 +359,7 @@ class KojiWrapper(object): for option, value in opts.items(): if isinstance(value, list): value = ",".join(value) - if not isinstance(value, six.string_types): + if not isinstance(value, str): # Python 3 configparser will reject non-string values. value = str(value) cfg_parser.set(section, option, value) @@ -765,11 +765,11 @@ class KojiWrapper(object): return results - @util.retry(wait_on=(xmlrpclib.ProtocolError, koji.GenericError)) + @util.retry(wait_on=(xmlrpc.client.ProtocolError, koji.GenericError)) def retrying_multicall_map(self, *args, **kwargs): """ Retrying version of multicall_map. This tries to retry the Koji call - in case of koji.GenericError or xmlrpclib.ProtocolError. + in case of koji.GenericError or xmlrpc.client.ProtocolError. Please refer to koji_multicall_map for further specification of arguments. """ diff --git a/pungi/wrappers/scm.py b/pungi/wrappers/scm.py index 991ce169..90bc14d1 100644 --- a/pungi/wrappers/scm.py +++ b/pungi/wrappers/scm.py @@ -19,10 +19,9 @@ from __future__ import absolute_import import os import shutil import glob -import six +import shlex import threading -from six.moves import shlex_quote -from six.moves.urllib.request import urlretrieve +from urllib.request import urlretrieve from fnmatch import fnmatch import kobo.log @@ -285,8 +284,8 @@ class RpmScmWrapper(ScmBase): run( "cp -a %s %s/" % ( - shlex_quote(os.path.join(tmp_dir, scm_dir)), - shlex_quote(target_dir), + shlex.quote(os.path.join(tmp_dir, scm_dir)), + shlex.quote(target_dir), ) ) @@ -398,7 +397,7 @@ def get_file_from_scm(scm_dict, target_path, compose=None): >>> get_file_from_scm(scm_dict, target_path) ['/tmp/path/share/variants.dtd'] """ - if isinstance(scm_dict, six.string_types): + if isinstance(scm_dict, str): scm_type = "file" scm_repo = None scm_file = os.path.abspath(scm_dict) @@ -491,7 +490,7 @@ def get_dir_from_scm(scm_dict, target_path, compose=None): >>> get_dir_from_scm(scm_dict, target_path) ['/tmp/path/share/variants.dtd', '/tmp/path/share/rawhide-fedora.ks', ...] """ - if isinstance(scm_dict, six.string_types): + if isinstance(scm_dict, str): scm_type = "file" scm_repo = None scm_dir = os.path.abspath(scm_dict) diff --git a/pungi_utils/patch_iso.py b/pungi_utils/patch_iso.py index 8a9d94d4..469736dd 100644 --- a/pungi_utils/patch_iso.py +++ b/pungi_utils/patch_iso.py @@ -15,8 +15,8 @@ from kobo import shortcuts import os import productmd +import shlex import tempfile -from six.moves import shlex_quote from pungi import util from pungi.phases.buildinstall import tweak_configs @@ -24,7 +24,7 @@ from pungi.wrappers import iso def sh(log, cmd, *args, **kwargs): - log.info("Running: %s", " ".join(shlex_quote(x) for x in cmd)) + log.info("Running: %s", " ".join(shlex.quote(x) for x in cmd)) ret, out = shortcuts.run(cmd, *args, universal_newlines=True, **kwargs) if out: log.debug("%s", out) diff --git a/setup.py b/setup.py index 724620f5..bd15cf58 100755 --- a/setup.py +++ b/setup.py @@ -61,7 +61,6 @@ setup( "kobo", "lxml", "productmd>=1.23", - "six", "dogpile.cache", ], extras_require={':python_version=="2.7"': ["enum34", "lockfile"]}, diff --git a/tests/helpers.py b/tests/helpers.py index 569a53d0..51a7d013 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -8,8 +8,10 @@ import shutil import tempfile from collections import defaultdict -from unittest import mock -import six +try: + from unittest import mock +except ImportError: + import mock from kobo.rpmlib import parse_nvr import unittest @@ -303,7 +305,7 @@ def touch(path, content=None, mode=None): os.makedirs(os.path.dirname(path)) except OSError: pass - if not isinstance(content, six.binary_type): + if not isinstance(content, bytes): content = content.encode() with open(path, "wb") as f: f.write(content) diff --git a/tests/test_arguments.py b/tests/test_arguments.py index 55ca28e1..a5702b5b 100644 --- a/tests/test_arguments.py +++ b/tests/test_arguments.py @@ -1,22 +1,18 @@ from unittest import mock +import io import unittest -import six from pungi.scripts.pungi_koji import cli_main class PungiKojiTestCase(unittest.TestCase): @mock.patch("sys.argv", new=["prog", "--version"]) - @mock.patch("sys.stderr", new_callable=six.StringIO) - @mock.patch("sys.stdout", new_callable=six.StringIO) + @mock.patch("sys.stderr", new_callable=io.StringIO) + @mock.patch("sys.stdout", new_callable=io.StringIO) @mock.patch("pungi.scripts.pungi_koji.get_full_version", return_value="a-b-c.111") def test_version(self, get_full_version, stdout, stderr): with self.assertRaises(SystemExit) as cm: cli_main() self.assertEqual(cm.exception.code, 0) - # Python 2.7 prints the version to stderr, 3.4+ to stdout. - if six.PY3: - self.assertMultiLineEqual(stdout.getvalue(), "a-b-c.111\n") - else: - self.assertMultiLineEqual(stderr.getvalue(), "a-b-c.111\n") + self.assertMultiLineEqual(stdout.getvalue(), "a-b-c.111\n") diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 61e90575..1080f40a 100644 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -import unittest - -from unittest import mock -import six +try: + from unittest import mock +except ImportError: + import mock from copy import copy -from six.moves import StringIO +from io import StringIO from ddt import ddt, data import os @@ -117,8 +117,7 @@ class TestBuildinstallPhase(PungiTestCase): # Server.x86_64, Client.amd64, Server.x86_64 pool = poolCls.return_value self.assertEqual(3, len(pool.queue_put.mock_calls)) - six.assertCountEqual( - self, + self.assertCountEqual( [call[0][0][3] for call in pool.queue_put.call_args_list], [ "rm -rf %s/work/amd64/buildinstall/Client && lorax ..." % self.topdir, @@ -128,8 +127,7 @@ class TestBuildinstallPhase(PungiTestCase): ) # Obtained correct lorax commands. - six.assertCountEqual( - self, + self.assertCountEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [ mock.call( @@ -221,8 +219,7 @@ class TestBuildinstallPhase(PungiTestCase): ), ], ) - six.assertCountEqual( - self, + self.assertCountEqual( get_volid.mock_calls, [ mock.call( @@ -361,14 +358,12 @@ class TestBuildinstallPhase(PungiTestCase): # Server.x86_64, Client.amd64, Server.x86_64 pool = poolCls.return_value self.assertEqual(3, len(pool.queue_put.mock_calls)) - six.assertCountEqual( - self, + self.assertCountEqual( [call[0][0][3] for call in pool.queue_put.call_args_list], expected_args, ) - six.assertCountEqual( - self, + self.assertCountEqual( get_volid.mock_calls, [ mock.call( @@ -520,8 +515,7 @@ class TestBuildinstallPhase(PungiTestCase): # Server.x86_64, Client.amd64, Server.x86_64 pool = poolCls.return_value self.assertEqual(3, len(pool.queue_put.mock_calls)) - six.assertCountEqual( - self, + self.assertCountEqual( [call[0][0][3] for call in pool.queue_put.call_args_list], [ "rm -rf %s/work/amd64/buildinstall/Client && lorax ..." % self.topdir, @@ -531,8 +525,7 @@ class TestBuildinstallPhase(PungiTestCase): ) # Obtained correct lorax commands. - six.assertCountEqual( - self, + self.assertCountEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [ mock.call( @@ -627,8 +620,7 @@ class TestBuildinstallPhase(PungiTestCase): ), ], ) - six.assertCountEqual( - self, + self.assertCountEqual( get_volid.mock_calls, [ mock.call( @@ -655,8 +647,7 @@ class TestBuildinstallPhase(PungiTestCase): There should be one get_file call. This is because the configuration_file option was used only once in the above configuration. """ - six.assertCountEqual( - self, + self.assertCountEqual( get_file.mock_calls, [ mock.call( @@ -703,8 +694,7 @@ class TestBuildinstallPhase(PungiTestCase): # Server.x86_64, Client.amd64, Server.x86_64 pool = poolCls.return_value self.assertEqual(3, len(pool.queue_put.mock_calls)) - six.assertCountEqual( - self, + self.assertCountEqual( [call[0][0][3] for call in pool.queue_put.call_args_list], [ "rm -rf %s/work/amd64/buildinstall/Client && lorax ..." % self.topdir, @@ -714,8 +704,7 @@ class TestBuildinstallPhase(PungiTestCase): ) # Obtained correct lorax commands. - six.assertCountEqual( - self, + self.assertCountEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [ mock.call( @@ -804,8 +793,7 @@ class TestBuildinstallPhase(PungiTestCase): ), ], ) - six.assertCountEqual( - self, + self.assertCountEqual( get_volid.mock_calls, [ mock.call( @@ -862,8 +850,7 @@ class TestBuildinstallPhase(PungiTestCase): # Server.x86_64, Client.amd64, Server.x86_64 pool = poolCls.return_value self.assertEqual(3, len(pool.queue_put.mock_calls)) - six.assertCountEqual( - self, + self.assertCountEqual( [call[0][0][3] for call in pool.queue_put.call_args_list], [ "rm -rf %s/amd64/Client && lorax ..." % buildinstall_topdir, @@ -873,8 +860,7 @@ class TestBuildinstallPhase(PungiTestCase): ) # Obtained correct lorax commands. - six.assertCountEqual( - self, + self.assertCountEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [ mock.call( @@ -963,8 +949,7 @@ class TestBuildinstallPhase(PungiTestCase): ), ], ) - six.assertCountEqual( - self, + self.assertCountEqual( get_volid.mock_calls, [ mock.call( @@ -1023,8 +1008,7 @@ class TestBuildinstallPhase(PungiTestCase): phase.run() self.maxDiff = None - six.assertCountEqual( - self, + self.assertCountEqual( loraxCls.return_value.get_lorax_cmd.mock_calls, [ mock.call( @@ -1202,8 +1186,8 @@ class BuildinstallThreadTestCase(PungiTestCase): self.topdir + "/logs/x86_64/buildinstall-Server-RPMs.x86_64.log" ) as f: rpms = f.read().strip().split("\n") - six.assertCountEqual(self, rpms, ["bash", "zsh"]) - six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")]) + self.assertCountEqual(rpms, ["bash", "zsh"]) + self.assertCountEqual(self.pool.finished_tasks, [("Server", "x86_64")]) self.assertEqual( mock_tweak.call_args_list, @@ -1297,8 +1281,8 @@ class BuildinstallThreadTestCase(PungiTestCase): self.topdir + "/logs/x86_64/buildinstall-Server-RPMs.x86_64.log" ) as f: rpms = f.read().strip().split("\n") - six.assertCountEqual(self, rpms, ["bash", "zsh"]) - six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")]) + self.assertCountEqual(rpms, ["bash", "zsh"]) + self.assertCountEqual(self.pool.finished_tasks, [("Server", "x86_64")]) self.assertEqual( mock_tweak.call_args_list, @@ -1378,7 +1362,6 @@ class BuildinstallThreadTestCase(PungiTestCase): ) self.assertEqual(self.pool.finished_tasks, set()) - @unittest.skipUnless(six.PY3, "PY2 StringIO does not work with 'with' statement") @mock.patch("pungi.wrappers.kojiwrapper.KojiWrapper") @mock.patch("pungi.wrappers.kojiwrapper.get_buildroot_rpms") @mock.patch("pungi.phases.buildinstall.run") @@ -1565,14 +1548,13 @@ class BuildinstallThreadTestCase(PungiTestCase): self.topdir + "/logs/x86_64/buildinstall-Server-RPMs.x86_64.log" ) as f: rpms = f.read().strip().split("\n") - six.assertCountEqual(self, rpms, ["bash", "zsh"]) - six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")]) + self.assertCountEqual(rpms, ["bash", "zsh"]) + self.assertCountEqual(self.pool.finished_tasks, [("Server", "x86_64")]) buildinstall_topdir = os.path.join( "/buildinstall_topdir", "buildinstall-" + os.path.basename(self.topdir) ) - six.assertCountEqual( - self, + self.assertCountEqual( copy_all.mock_calls, [ mock.call( diff --git a/tests/test_checks.py b/tests/test_checks.py index 2cd662ef..f23afcc6 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -4,7 +4,7 @@ from unittest import mock import unittest import os -from six import StringIO +from io import StringIO import kobo.conf diff --git a/tests/test_compose.py b/tests/test_compose.py index 67ba2fe4..4ef8de49 100644 --- a/tests/test_compose.py +++ b/tests/test_compose.py @@ -6,7 +6,6 @@ from unittest import mock import json import os import shutil -import six import tempfile import unittest @@ -394,22 +393,17 @@ class ComposeTestCase(unittest.TestCase): sorted(v.uid for v in compose.variants["Server"].variants.values()), ["Server-Gluster", "Server-ResilientStorage", "Server-optional"], ) - six.assertCountEqual( - self, compose.variants["Client"].arches, ["i386", "x86_64"] - ) + self.assertCountEqual(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.assertCountEqual(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, + self.assertCountEqual( compose.variants["Server"].variants["optional"].arches, ["s390x", "x86_64"], ) @@ -503,12 +497,8 @@ class ComposeTestCase(unittest.TestCase): self.assertEqual( sorted(v.uid for v in compose.variants.values()), ["Client", "Server"] ) - six.assertCountEqual( - self, compose.variants["Client"].arches, ["i386", "x86_64"] - ) - six.assertCountEqual( - self, compose.variants["Server"].arches, ["s390x", "x86_64"] - ) + self.assertCountEqual(compose.variants["Client"].arches, ["i386", "x86_64"]) + self.assertCountEqual(compose.variants["Server"].arches, ["s390x", "x86_64"]) self.assertEqual( compose.variants["Server"].variants["Gluster"].arches, ["x86_64"] ) @@ -559,8 +549,7 @@ class ComposeTestCase(unittest.TestCase): ["Client", "Server", "Server-optional"], ) - six.assertCountEqual( - self, + self.assertCountEqual( logger.info.call_args_list, [ mock.call("Excluding variant Live: filtered by configuration."), diff --git a/tests/test_config.py b/tests/test_config.py index b7eb533f..68f5bd62 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -2,8 +2,10 @@ import unittest -import six -from unittest import mock +try: + from unittest import mock +except ImportError: + import mock from pungi import checks from tests.helpers import load_config, PKGSET_REPOS @@ -12,7 +14,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) - six.assertCountEqual(self, errors, actual_errors) + self.assertCountEqual(errors, actual_errors) self.assertEqual(warnings, actual_warnings) @@ -263,8 +265,7 @@ class GatherConfigTestCase(ConfigTestCase): pkgset_koji_tag="f27", ) - with mock.patch("six.PY2", new=False): - self.assertValidation(cfg, []) + self.assertValidation(cfg, []) self.assertEqual(cfg["gather_backend"], "dnf") def test_yum_backend_is_rejected_on_py3(self): @@ -274,11 +275,10 @@ class GatherConfigTestCase(ConfigTestCase): gather_backend="yum", ) - with mock.patch("six.PY2", new=False): - self.assertValidation( - cfg, - ["Failed validation in gather_backend: 'yum' is not one of ['dnf']"], - ) + self.assertValidation( + cfg, + ["Failed validation in gather_backend: 'yum' is not one of ['dnf']"], + ) class OSBSConfigTestCase(ConfigTestCase): @@ -437,9 +437,10 @@ class TestRegexValidation(ConfigTestCase): def test_incorrect_regular_expression(self): cfg = load_config(PKGSET_REPOS, multilib=[("^*$", {"*": []})]) - msg = "Failed validation in multilib.0.0: incorrect regular expression: nothing to repeat" # noqa: E501 - if six.PY3: - msg += " at position 1" + msg = ( + "Failed validation in multilib.0.0: incorrect regular expression: " + "nothing to repeat at position 1" + ) self.assertValidation(cfg, [msg], []) diff --git a/tests/test_config_validate_script.py b/tests/test_config_validate_script.py index 0933b441..1d96f8b8 100644 --- a/tests/test_config_validate_script.py +++ b/tests/test_config_validate_script.py @@ -1,9 +1,11 @@ # -*- coding: utf-8 -*- - -from unittest import mock +try: + from unittest import mock +except ImportError: + import mock +import io import os -import six from pungi.scripts.config_validate import cli_main from tests import helpers @@ -16,8 +18,8 @@ SCHEMA_OVERRIDE = os.path.join(HERE, "data/dummy-override.json") class ConfigValidateScriptTest(helpers.PungiTestCase): @mock.patch("sys.argv", new=["pungi-config-validate", DUMMY_CONFIG]) - @mock.patch("sys.stderr", new_callable=six.StringIO) - @mock.patch("sys.stdout", new_callable=six.StringIO) + @mock.patch("sys.stderr", new_callable=io.StringIO) + @mock.patch("sys.stdout", new_callable=io.StringIO) def test_validate_dummy_config(self, stdout, stderr): cli_main() self.assertEqual("", stdout.getvalue()) @@ -32,8 +34,8 @@ class ConfigValidateScriptTest(helpers.PungiTestCase): SCHEMA_OVERRIDE, ], ) - @mock.patch("sys.stderr", new_callable=six.StringIO) - @mock.patch("sys.stdout", new_callable=six.StringIO) + @mock.patch("sys.stderr", new_callable=io.StringIO) + @mock.patch("sys.stdout", new_callable=io.StringIO) @mock.patch("sys.exit") def test_schema_override(self, exit, stdout, stderr): cli_main() diff --git a/tests/test_createiso_phase.py b/tests/test_createiso_phase.py index 03f141ed..11239cb6 100644 --- a/tests/test_createiso_phase.py +++ b/tests/test_createiso_phase.py @@ -2,9 +2,12 @@ import logging -from unittest import mock import contextlib -import six + +try: + from unittest import mock +except ImportError: + import mock import productmd import os @@ -45,8 +48,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase): self.assertEqual(len(pool.add.call_args_list), 0) self.assertEqual(pool.queue_put.call_args_list, []) - six.assertCountEqual( - self, + self.assertCountEqual( phase.logger.warning.call_args_list, [ mock.call("No RPMs found for Everything.x86_64, skipping ISO"), @@ -193,8 +195,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase): phase.logger = mock.Mock() phase.run() - six.assertCountEqual( - self, + self.assertCountEqual( prepare_iso.call_args_list, [ mock.call( @@ -215,8 +216,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase): ), ], ) - six.assertCountEqual( - self, + self.assertCountEqual( split_iso.call_args_list, [ mock.call( @@ -237,8 +237,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase): ) self.assertEqual(len(pool.add.call_args_list), 2) self.maxDiff = None - six.assertCountEqual( - self, + self.assertCountEqual( [x[0][0] for x in write_script.call_args_list], [ CreateIsoOpts( @@ -273,8 +272,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase): ), ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pool.queue_put.call_args_list, [ mock.call( diff --git a/tests/test_createiso_script.py b/tests/test_createiso_script.py index dd0afce3..264ae449 100644 --- a/tests/test_createiso_script.py +++ b/tests/test_createiso_script.py @@ -4,7 +4,7 @@ from unittest import mock from parameterized import parameterized import os -from six.moves import StringIO +from io import StringIO from tests import helpers from pungi import createiso diff --git a/tests/test_createrepo_wrapper.py b/tests/test_createrepo_wrapper.py index a5513ffb..0c206678 100644 --- a/tests/test_createrepo_wrapper.py +++ b/tests/test_createrepo_wrapper.py @@ -2,8 +2,6 @@ import unittest -import six - from pungi.wrappers.createrepo import CreaterepoWrapper @@ -13,8 +11,8 @@ class CreateRepoWrapperTest(unittest.TestCase): cmd = repo.get_createrepo_cmd("/test/dir") self.assertEqual(cmd[:2], ["createrepo_c", "/test/dir"]) - six.assertCountEqual( - self, cmd[2:], ["--update", "--database", "--unique-md-filenames"] + self.assertCountEqual( + cmd[2:], ["--update", "--database", "--unique-md-filenames"] ) def test_get_createrepo_c_cmd_full(self): @@ -50,8 +48,7 @@ class CreateRepoWrapperTest(unittest.TestCase): self.maxDiff = None self.assertEqual(cmd[:2], ["createrepo_c", "/test/dir"]) - six.assertCountEqual( - self, + self.assertCountEqual( cmd[2:], [ "--baseurl=http://base.example.com", @@ -89,8 +86,7 @@ class CreateRepoWrapperTest(unittest.TestCase): cmd = repo.get_createrepo_cmd("/test/dir") self.assertEqual(cmd[:2], ["createrepo", "/test/dir"]) - six.assertCountEqual( - self, + self.assertCountEqual( cmd[2:], ["--update", "--database", "--unique-md-filenames", "--pretty"], ) @@ -126,8 +122,7 @@ class CreateRepoWrapperTest(unittest.TestCase): self.maxDiff = None self.assertEqual(cmd[:2], ["createrepo", "/test/dir"]) - six.assertCountEqual( - self, + self.assertCountEqual( cmd[2:], [ "--baseurl=http://base.example.com", diff --git a/tests/test_createrepophase.py b/tests/test_createrepophase.py index 7126d885..e2d84323 100644 --- a/tests/test_createrepophase.py +++ b/tests/test_createrepophase.py @@ -4,8 +4,10 @@ import glob import os import unittest -from unittest import mock -import six +try: + from unittest import mock +except ImportError: + import mock from pungi.module_util import Modulemd from pungi.phases.createrepo import ( @@ -71,8 +73,7 @@ class TestCreaterepoPhase(PungiTestCase): everything = compose.variants["Everything"] client = compose.variants["Client"] self.assertEqual(len(pool.add.mock_calls), 5) - six.assertCountEqual( - self, + self.assertCountEqual( pool.queue_put.mock_calls, [ mock.call((compose, "x86_64", server, "rpm")), @@ -107,8 +108,7 @@ class TestCreaterepoPhase(PungiTestCase): server = compose.variants["Server"] everything = compose.variants["Everything"] self.assertEqual(len(pool.add.mock_calls), 5) - six.assertCountEqual( - self, + self.assertCountEqual( pool.queue_put.mock_calls, [ mock.call((compose, "x86_64", server, "rpm")), @@ -159,8 +159,7 @@ 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) - six.assertCountEqual( - tc, + tc.assertCountEqual( ms.get_rpm_artifacts(), module_artifacts[ms.get_stream_name()], ) @@ -1356,7 +1355,7 @@ class TestGetProductIds(PungiTestCase): "productid", ) ) - six.assertCountEqual(self, pids, expected) + self.assertCountEqual(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 1b85be04..8cb0b6d9 100644 --- a/tests/test_extra_files_phase.py +++ b/tests/test_extra_files_phase.py @@ -5,8 +5,6 @@ import os from productmd.extra_files import ExtraFiles -import six - from pungi.phases import extra_files from tests import helpers @@ -31,8 +29,7 @@ class TestExtraFilePhase(helpers.PungiTestCase): phase = extra_files.ExtraFilesPhase(compose, pkgset_phase) phase.run() - six.assertCountEqual( - self, + self.assertCountEqual( copy_extra_files.call_args_list, [ mock.call( diff --git a/tests/test_extra_isos_phase.py b/tests/test_extra_isos_phase.py index 6826a9ab..f09bf26c 100644 --- a/tests/test_extra_isos_phase.py +++ b/tests/test_extra_isos_phase.py @@ -1,9 +1,13 @@ # -*- coding: utf-8 -*- -from typing import AnyStr, List -from unittest import mock -import six + import logging +try: + from unittest import mock +except ImportError: + import mock +from typing import AnyStr, List + import os from tests import helpers @@ -35,8 +39,7 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase): phase.run() self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 3) - six.assertCountEqual( - self, + self.assertCountEqual( ThreadPool.return_value.queue_put.call_args_list, [ mock.call((compose, cfg, compose.variants["Server"], "x86_64")), @@ -56,8 +59,7 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase): phase.run() self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2) - six.assertCountEqual( - self, + self.assertCountEqual( ThreadPool.return_value.queue_put.call_args_list, [ mock.call((compose, cfg, compose.variants["Server"], "x86_64")), @@ -76,8 +78,7 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase): phase.run() self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2) - six.assertCountEqual( - self, + self.assertCountEqual( ThreadPool.return_value.queue_put.call_args_list, [ mock.call((compose, cfg, compose.variants["Server"], "x86_64")), @@ -671,8 +672,7 @@ class GetIsoContentsTest(helpers.PungiTestCase): "Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml", } - six.assertCountEqual( - self, + self.assertCountEqual( ggp.call_args_list, [ mock.call( @@ -753,8 +753,7 @@ class GetIsoContentsTest(helpers.PungiTestCase): "Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml", } - six.assertCountEqual( - self, + self.assertCountEqual( ggp.call_args_list, [ mock.call( @@ -831,8 +830,7 @@ class GetIsoContentsTest(helpers.PungiTestCase): "Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml", } - six.assertCountEqual( - self, + self.assertCountEqual( ggp.call_args_list, [ mock.call( @@ -934,8 +932,7 @@ class GetIsoContentsTest(helpers.PungiTestCase): ), } - six.assertCountEqual( - self, + self.assertCountEqual( ggp.call_args_list, [ mock.call( diff --git a/tests/test_fus_wrapper.py b/tests/test_fus_wrapper.py index 1483ade5..b2b31f0f 100644 --- a/tests/test_fus_wrapper.py +++ b/tests/test_fus_wrapper.py @@ -4,8 +4,6 @@ import unittest import tempfile from textwrap import dedent -import six - import os from pungi.wrappers import fus @@ -133,8 +131,7 @@ class TestParseOutput(unittest.TestCase): 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) - six.assertCountEqual( - self, + self.assertCountEqual( packages, [("pkg-1.0-1", "x86_64", frozenset()), ("pkg-1.0-1", "i686", frozenset())], ) diff --git a/tests/test_gather.py b/tests/test_gather.py index d97a4ee8..6e3927a0 100644 --- a/tests/test_gather.py +++ b/tests/test_gather.py @@ -3,12 +3,10 @@ import logging import os import shutil -import six import sys import tempfile import unittest - -from six.moves import cStringIO +from io import StringIO from pungi.wrappers.pungi import PungiWrapper @@ -65,8 +63,7 @@ class DepsolvingBase(object): self.assertNotIn("dummy-kernel-3.1.0-1.i686.rpm", pkg_map["rpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-kernel-3.1.0-1.x86_64.rpm", # Important @@ -103,8 +100,7 @@ class DepsolvingBase(object): self.assertNotIn("dummy-kernel-3.1.0-1.i686.rpm", pkg_map["rpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-kernel-3.1.0-1.x86_64.rpm", # Important @@ -124,8 +120,7 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.ppc.rpm", pkg_map["rpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -137,8 +132,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.ppc64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -147,8 +141,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.ppc64.rpm", @@ -166,8 +159,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none", fulltree=True) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-foo32-1-1.i686.rpm", # Important @@ -185,8 +177,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -196,8 +187,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -206,8 +196,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", @@ -223,8 +212,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -234,8 +222,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -244,8 +231,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.i686.rpm", @@ -265,8 +251,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -276,8 +261,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -286,8 +270,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", @@ -307,8 +290,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -318,8 +300,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.s390x.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -328,8 +309,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.s390x.rpm", @@ -349,8 +329,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -364,8 +343,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -374,8 +352,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.i686.rpm", @@ -399,8 +376,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -410,8 +386,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -420,8 +395,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-5.x86_64.rpm", @@ -461,8 +435,7 @@ class DepsolvingBase(object): self.assertNotIn("dummy-release-notes-1.2-1.noarch.rpm", pkg_map["rpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-release-client-1.0.0-1.i686.rpm", # Important @@ -473,8 +446,7 @@ class DepsolvingBase(object): "dummy-release-server-1.0.0-1.x86_64.rpm", # Important ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-release-client-1.0.0-1.src.rpm", @@ -494,8 +466,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -506,8 +477,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -517,8 +487,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", @@ -539,8 +508,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -551,8 +519,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -562,8 +529,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", @@ -579,8 +545,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -598,8 +563,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -610,8 +574,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.i686.rpm", @@ -636,8 +599,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -655,8 +617,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -667,8 +628,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.i686.rpm", @@ -692,8 +652,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -711,8 +670,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -723,8 +681,7 @@ class DepsolvingBase(object): "dummy-vacation-1.2.7.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.i686.rpm", @@ -752,8 +709,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -764,8 +720,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -775,8 +730,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", @@ -797,8 +751,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-bash-4.2.37-6.x86_64.rpm", @@ -813,8 +766,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-bash-4.2.37-6.src.rpm", @@ -826,8 +778,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", @@ -851,8 +802,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -863,8 +813,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -874,8 +823,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", @@ -903,8 +851,7 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, lookaside=self.lookaside) self.assertEqual(self.broken_deps, {}) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-cockpit-docker-141-1.noarch.rpm", @@ -947,8 +894,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -960,8 +906,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -971,8 +916,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", @@ -994,8 +938,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-bash-4.2.37-6.x86_64.rpm", @@ -1013,8 +956,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-bash-4.2.37-6.src.rpm", @@ -1026,8 +968,7 @@ class DepsolvingBase(object): "Dummy-xulrunner-16.0.1-1.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", @@ -1049,8 +990,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1064,8 +1004,7 @@ class DepsolvingBase(object): "dummy-nscd-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1074,8 +1013,7 @@ class DepsolvingBase(object): "dummy-krb5-1.10-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", @@ -1093,8 +1031,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1107,8 +1044,7 @@ class DepsolvingBase(object): "dummy-nscd-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1117,8 +1053,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.i686.rpm", @@ -1136,8 +1071,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, multilib_blacklist=["dummy-glibc*"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1146,8 +1080,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1155,8 +1088,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", @@ -1176,8 +1108,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1189,8 +1120,7 @@ class DepsolvingBase(object): "dummy-nscd-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1199,8 +1129,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.i686.rpm", @@ -1221,8 +1150,7 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.src.rpm", pkg_map["srpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1232,8 +1160,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1241,8 +1168,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.i686.rpm", @@ -1260,8 +1186,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all", fulltree=True) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1278,8 +1203,7 @@ class DepsolvingBase(object): "dummy-nscd-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1288,8 +1212,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.i686.rpm", @@ -1312,8 +1235,7 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1326,8 +1248,7 @@ class DepsolvingBase(object): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1336,8 +1257,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.i686.rpm", @@ -1358,8 +1278,7 @@ class DepsolvingBase(object): self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1375,8 +1294,7 @@ class DepsolvingBase(object): "dummy-nscd-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1385,8 +1303,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", @@ -1409,8 +1326,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-filesystem-4.2.37-6.i686.rpm", @@ -1427,8 +1343,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none", fulltree=True) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-kmod-ipw3945-1.2.0-4.20.x86_64.rpm", # Important @@ -1452,8 +1367,7 @@ class DepsolvingBase(object): multilib_methods=["devel", "runtime"], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1467,8 +1381,7 @@ class DepsolvingBase(object): "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1477,8 +1390,7 @@ class DepsolvingBase(object): "dummy-lvm2-2.02.84-4.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", @@ -1496,16 +1408,14 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="ppc64") - six.assertCountEqual( - self, + self.assertCountEqual( 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, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-freeipa-2.2.0-1.src.rpm", @@ -1520,8 +1430,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="ppc64") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important @@ -1530,8 +1439,7 @@ class DepsolvingBase(object): "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-freeipa-2.2.0-1.src.rpm", @@ -1551,16 +1459,14 @@ class DepsolvingBase(object): "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", pkg_map["rpm"] ) - six.assertCountEqual( - self, + self.assertCountEqual( 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, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-freeipa-2.2.0-1.src.rpm", @@ -1573,8 +1479,7 @@ class DepsolvingBase(object): packages = ["dummy-selinux-policy-doc"] pkg_map = self.go(packages, None, fulltree=True) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-selinux-policy-doc-3.10.0-121.noarch.rpm", @@ -1592,8 +1497,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-AdobeReader_enu-9.5.1-1.i486.rpm", # Important @@ -1603,8 +1507,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-AdobeReader_enu-9.5.1-1.nosrc.rpm", @@ -1613,8 +1516,7 @@ class DepsolvingBase(object): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", @@ -1631,8 +1533,7 @@ class DepsolvingBase(object): self.assertNotIn("dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", pkg_map["rpm"]) # prefers qt over gnome (shorter name) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important @@ -1654,8 +1555,7 @@ 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) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important @@ -1693,8 +1593,7 @@ class DepsolvingBase(object): ) # prefers gnome over qt (condrequires in @basic-desktop) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important @@ -1717,8 +1616,7 @@ class DepsolvingBase(object): 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, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", @@ -1736,8 +1634,7 @@ 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"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-bash-4.2.37-6.x86_64.rpm", # Important @@ -1745,8 +1642,7 @@ class DepsolvingBase(object): ], ) self.assertEqual(pkg_map["srpm"], ["dummy-bash-4.2.37-6.src.rpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", @@ -1776,8 +1672,7 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, greedy="none", nodeps=True, fulltree=True) # neither dummy-bash or dummy-basesystem is pulled in - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-glibc-2.14-5.x86_64.rpm", @@ -1786,8 +1681,7 @@ class DepsolvingBase(object): ], ) self.assertEqual(pkg_map["srpm"], ["dummy-glibc-2.14-5.src.rpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", @@ -1801,8 +1695,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="x86_64") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], ["dummy-atlas-3.8.4-7.x86_64.rpm", "dummy-atlas-devel-3.8.4-7.x86_64.rpm"], ) @@ -1816,8 +1709,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="x86_64") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-atlas-3.8.4-7.x86_64.rpm", @@ -1841,8 +1733,7 @@ class DepsolvingBase(object): arch="x86_64", ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-atlas-3.8.4-7.x86_64.rpm", @@ -1867,8 +1758,7 @@ class DepsolvingBase(object): arch="x86_64", ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-atlas-3.8.4-7.x86_64.rpm", @@ -1885,8 +1775,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="all", fulltree=False, arch="x86_64") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-atlas-3.8.4-7.i686.rpm", @@ -1909,8 +1798,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="x86_64") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-skype-4.2.0.13-1.i586.rpm", @@ -1921,8 +1809,7 @@ class DepsolvingBase(object): ], ) # no SRPM for skype - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1930,8 +1817,7 @@ class DepsolvingBase(object): "dummy-filesystem-4.2.37-6.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", @@ -1952,8 +1838,7 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, prepopulate=prepopulate) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -1966,8 +1851,7 @@ class DepsolvingBase(object): "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -1977,8 +1861,7 @@ class DepsolvingBase(object): "dummy-lvm2-2.02.84-4.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.i686.rpm", @@ -1997,8 +1880,7 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-release-notes-1.2-1.noarch.rpm", @@ -2006,8 +1888,7 @@ class DepsolvingBase(object): "dummy-release-notes-en-US-1.2-1.noarch.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-release-notes-1.2-1.src.rpm", @@ -2025,8 +1906,7 @@ class DepsolvingBase(object): pkg_map = self.go(packages, None, multilib_whitelist=["dummy-glibc"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-filesystem-4.2.37-6.x86_64.rpm", @@ -2036,8 +1916,7 @@ class DepsolvingBase(object): "dummy-basesystem-10.0-6.noarch.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -2045,8 +1924,7 @@ class DepsolvingBase(object): "dummy-filesystem-4.2.37-6.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.i686.rpm", @@ -2080,16 +1958,14 @@ class DepsolvingBase(object): ] pkg_map = self.go(packages, None) - six.assertCountEqual( - self, + self.assertCountEqual( 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, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-release-notes-cs-CZ-1.2-1.src.rpm", @@ -2102,8 +1978,7 @@ class DepsolvingBase(object): packages = ["dummy-perl"] pkg_map = self.go(packages, None) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-perl-1.0.0-1.x86_64.rpm", @@ -2185,7 +2060,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): self.g.logger.handlers = [ h for h in self.g.logger.handlers if h.name != "capture-logs" ] - log_output = cStringIO() + log_output = StringIO() handler = logging.StreamHandler(log_output) handler.name = "capture-logs" handler.setLevel(logging.WARNING) @@ -2267,14 +2142,12 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): pkg_map = self.go(packages, None) - six.assertCountEqual( - self, + self.assertCountEqual( 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, + self.assertCountEqual( pkg_map["debuginfo"], [ "libuser-debuginfo-1-1.i686.rpm", @@ -2288,8 +2161,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): ] pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="x86_64") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-skype-4.2.0.13-1.i586.rpm", @@ -2300,8 +2172,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): ], ) # no SRPM for skype - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -2309,8 +2180,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-filesystem-4.2.37-6.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", @@ -2326,8 +2196,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): ] pkg_map = self.go(packages, None, greedy="none") - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -2337,8 +2206,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -2347,8 +2215,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.i686.rpm", @@ -2365,8 +2232,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): pkg_map = self.go(packages, None, greedy="none", nodeps=True, fulltree=True) # neither dummy-bash or dummy-basesystem is pulled in - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-glibc-2.14-5.x86_64.rpm", @@ -2388,8 +2254,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): self.assertNotIn("dummy-bash-4.2.37-6.src.rpm", pkg_map["srpm"]) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -2399,8 +2264,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -2408,8 +2272,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.i686.rpm", @@ -2426,8 +2289,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): ] pkg_map = self.go(packages, None, greedy="none", fulltree=True) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-kmod-ipw3945-1.2.0-4.20.x86_64.rpm", # Important @@ -2449,8 +2311,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): multilib_methods=["devel", "runtime"], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -2464,8 +2325,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -2474,8 +2334,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-lvm2-2.02.84-4.src.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", @@ -2490,8 +2349,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): packages = ["dummy-bash"] pkg_map = self.go(packages, None, exclude_source=True) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -2501,9 +2359,8 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual(self, pkg_map["srpm"], []) - six.assertCountEqual( - self, + self.assertCountEqual(pkg_map["srpm"], []) + self.assertCountEqual( pkg_map["debuginfo"], [ "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", @@ -2517,8 +2374,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): packages = ["dummy-bash"] pkg_map = self.go(packages, None, exclude_debug=True) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["rpm"], [ "dummy-basesystem-10.0-6.noarch.rpm", @@ -2528,8 +2384,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-glibc-common-2.14-5.x86_64.rpm", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( pkg_map["srpm"], [ "dummy-basesystem-10.0-6.src.rpm", @@ -2538,15 +2393,14 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase): "dummy-glibc-2.14-5.src.rpm", ], ) - six.assertCountEqual(self, pkg_map["debuginfo"], []) + self.assertCountEqual(pkg_map["debuginfo"], []) def test_explicit_debug(self): pkg_map = self.go(["dummy-bash-debuginfo"], None) - six.assertCountEqual(self, pkg_map["rpm"], []) - six.assertCountEqual(self, pkg_map["srpm"], []) - six.assertCountEqual( - self, + self.assertCountEqual(pkg_map["rpm"], []) + self.assertCountEqual(pkg_map["srpm"], []) + self.assertCountEqual( pkg_map["debuginfo"], ["dummy-bash-debuginfo-4.2.37-6.x86_64.rpm"], ) diff --git a/tests/test_gather_method_hybrid.py b/tests/test_gather_method_hybrid.py index 711df27d..df22b7fc 100644 --- a/tests/test_gather_method_hybrid.py +++ b/tests/test_gather_method_hybrid.py @@ -5,8 +5,6 @@ import copy from unittest import mock import os -import six - from pungi.phases.gather.methods import method_hybrid as hybrid from pungi.phases.pkgset.common import MaterializedPackageSet as PkgSet from tests import helpers @@ -210,7 +208,7 @@ class TestMethodHybrid(helpers.PungiTestCase): ] expanded = m.expand_list(["foo*"]) - six.assertCountEqual(self, [p.name for p in expanded], ["foo", "foo-en"]) + self.assertCountEqual([p.name for p in expanded], ["foo", "foo-en"]) class MockModule(object): @@ -445,7 +443,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): cache_dir="/cache", ) - six.assertCountEqual(self, res[0], po.return_value[0]) + self.assertCountEqual(res[0], po.return_value[0]) self.assertEqual(res[1], set()) self.assertEqual(po.call_args_list, [mock.call(self.logfile1)]) self.assertEqual( @@ -512,8 +510,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): cache_dir="/cache", ) - six.assertCountEqual( - self, + self.assertCountEqual( res[0], [ ("pkg-1.0-1", "x86_64", frozenset()), @@ -585,7 +582,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): cache_dir="/cache", ) - six.assertCountEqual(self, res[0], final) + self.assertCountEqual(res[0], final) self.assertEqual(res[1], set()) self.assertEqual( po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)] @@ -675,8 +672,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): cache_dir="/cache", ) - six.assertCountEqual( - self, + self.assertCountEqual( res[0], [ ("pkg-devel-1.0-1", "x86_64", frozenset()), @@ -796,8 +792,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase): cache_dir="/cache", ) - six.assertCountEqual( - self, + self.assertCountEqual( res[0], [ ("pkg-devel-1.0-1", "x86_64", frozenset()), diff --git a/tests/test_gather_method_nodeps.py b/tests/test_gather_method_nodeps.py index 02eafab1..12c5bf50 100644 --- a/tests/test_gather_method_nodeps.py +++ b/tests/test_gather_method_nodeps.py @@ -3,8 +3,6 @@ from unittest import mock import os -import six - from pungi.phases.gather.methods import method_nodeps as nodeps from tests import helpers @@ -21,8 +19,7 @@ class TestWritePungiConfig(helpers.PungiTestCase): packages = nodeps.expand_groups( self.compose, "x86_64", None, ["core", "text-internet"] ) - six.assertCountEqual( - self, + self.assertCountEqual( packages, [ ("dummy-bash", "x86_64"), diff --git a/tests/test_gather_phase.py b/tests/test_gather_phase.py index 08cbb442..e47c171e 100644 --- a/tests/test_gather_phase.py +++ b/tests/test_gather_phase.py @@ -8,8 +8,6 @@ from unittest import mock import unittest -import six - from pungi.phases import gather from pungi.phases.gather import _mk_pkg_map from pungi.phases.pkgset.common import MaterializedPackageSet @@ -137,8 +135,7 @@ class TestGatherWrapper(helpers.PungiTestCase): } }, ) - six.assertCountEqual( - self, + self.assertCountEqual( write_packages.call_args_list, [ mock.call( @@ -191,8 +188,7 @@ class TestGatherWrapper(helpers.PungiTestCase): } }, ) - six.assertCountEqual( - self, + self.assertCountEqual( write_packages.call_args_list, [ mock.call( @@ -252,8 +248,7 @@ class TestGatherWrapper(helpers.PungiTestCase): } }, ) - six.assertCountEqual( - self, + self.assertCountEqual( write_packages.call_args_list, [ mock.call( @@ -340,8 +335,7 @@ class TestGatherWrapper(helpers.PungiTestCase): } }, ) - six.assertCountEqual( - self, + self.assertCountEqual( write_packages.call_args_list, [ mock.call( @@ -420,8 +414,7 @@ class TestGatherWrapper(helpers.PungiTestCase): } }, ) - six.assertCountEqual( - self, + self.assertCountEqual( write_packages.call_args_list, [ mock.call( @@ -565,8 +558,7 @@ class TestGetSystemRelease(unittest.TestCase): ) self.assertEqual(packages, set([("system-release-server", None)])) - six.assertCountEqual( - self, + self.assertCountEqual( filter_packages, set([("system-release-client", None), ("system-release", None)]), ) @@ -678,8 +670,7 @@ class TestWritePackages(helpers.PungiTestCase): self.topdir, "work", "x86_64", "package_list", "Server.x86_64.rpm.conf" ) ) as f: - six.assertCountEqual( - self, + self.assertCountEqual( f.read().strip().split("\n"), [ "/build/foo-1.0-1.x86_64.rpm", @@ -693,8 +684,7 @@ class TestWritePackages(helpers.PungiTestCase): self.topdir, "work", "x86_64", "package_list", "Server.x86_64.srpm.conf" ) ) as f: - six.assertCountEqual( - self, + self.assertCountEqual( f.read().strip().split("\n"), ["/build/foo-1.0-1.src.rpm", "/build/bar-1.0-1.src.rpm"], ) @@ -809,8 +799,8 @@ class TestGetVariantPackages(helpers.PungiTestCase): packages, groups, filter_packages = gather.get_variant_packages( compose, "x86_64", compose.all_variants["Server-optional"], "comps" ) - six.assertCountEqual(self, packages, ["server-pkg", "addon-pkg", "opt-pkg"]) - six.assertCountEqual(self, groups, ["server-group", "addon-group", "opt-group"]) + self.assertCountEqual(packages, ["server-pkg", "addon-pkg", "opt-pkg"]) + self.assertCountEqual(groups, ["server-group", "addon-group", "opt-group"]) self.assertEqual(filter_packages, set()) @mock.patch("pungi.phases.gather.get_gather_source") @@ -847,7 +837,7 @@ class TestGetVariantPackages(helpers.PungiTestCase): packages, groups, filter_packages = gather.get_variant_packages( compose, "x86_64", compose.all_variants["Server"], "comps" ) - six.assertCountEqual(self, packages, [("pkg", None), ("foo", "x86_64")]) + self.assertCountEqual(packages, [("pkg", None), ("foo", "x86_64")]) self.assertEqual(groups, set()) self.assertEqual(filter_packages, set()) @@ -1422,8 +1412,7 @@ class TestGetPrepopulate(helpers.PungiTestCase): "prepopulate.json", os.path.join(self.topdir, "work", "global", "prepopulate.json"), ) - six.assertCountEqual( - self, + self.assertCountEqual( gather.get_prepopulate_packages( self.compose, "x86_64", self.compose.variants["Server"] ), @@ -1435,8 +1424,7 @@ class TestGetPrepopulate(helpers.PungiTestCase): "prepopulate.json", os.path.join(self.topdir, "work", "global", "prepopulate.json"), ) - six.assertCountEqual( - self, + self.assertCountEqual( gather.get_prepopulate_packages(self.compose, "x86_64", None), ["foo-common.noarch", "foo.i686", "foo.x86_64", "bar.x86_64"], ) @@ -1446,8 +1434,7 @@ class TestGetPrepopulate(helpers.PungiTestCase): "prepopulate.json", os.path.join(self.topdir, "work", "global", "prepopulate.json"), ) - six.assertCountEqual( - self, + self.assertCountEqual( gather.get_prepopulate_packages( self.compose, "x86_64", None, include_arch=False ), @@ -1483,8 +1470,7 @@ class TestGatherPhase(helpers.PungiTestCase): gather_wrapper.call_args_list, [mock.call(compose, pkgset_phase.package_sets, pkgset_phase.path_prefix)], ) - six.assertCountEqual( - self, + self.assertCountEqual( link_files.call_args_list, [ _mk_link_call("x86_64", "Server"), @@ -1582,7 +1568,7 @@ class TestGetPackagesToGather(helpers.PungiTestCase): packages, groups = gather.get_packages_to_gather(self.compose) - six.assertCountEqual(self, packages, ["foo", "foo2.x86_64", "pkg"]) + self.assertCountEqual(packages, ["foo", "foo2.x86_64", "pkg"]) self.assertEqual(groups, ["core"]) @mock.patch("pungi.phases.gather.get_gather_source") @@ -1595,7 +1581,7 @@ class TestGetPackagesToGather(helpers.PungiTestCase): self.compose, include_arch=False ) - six.assertCountEqual(self, packages, ["foo", "foo2", "pkg"]) + self.assertCountEqual(packages, ["foo", "foo2", "pkg"]) self.assertEqual(groups, ["core"]) @mock.patch("pungi.phases.gather.get_gather_source") @@ -1608,8 +1594,7 @@ class TestGetPackagesToGather(helpers.PungiTestCase): self.compose, include_prepopulated=True ) - six.assertCountEqual( - self, + self.assertCountEqual( packages, [ "foo", @@ -1633,9 +1618,7 @@ class TestGetPackagesToGather(helpers.PungiTestCase): self.compose, include_prepopulated=True, include_arch=False ) - six.assertCountEqual( - self, packages, ["foo", "pkg", "foo-common", "foo2", "bar"] - ) + self.assertCountEqual(packages, ["foo", "pkg", "foo-common", "foo2", "bar"]) self.assertEqual(groups, ["core"]) @mock.patch("pungi.phases.gather.get_gather_source") @@ -1646,7 +1629,7 @@ class TestGetPackagesToGather(helpers.PungiTestCase): packages, groups = gather.get_packages_to_gather(self.compose, "x86_64") - six.assertCountEqual(self, packages, ["foo", "pkg", "foo2.x86_64"]) + self.assertCountEqual(packages, ["foo", "pkg", "foo2.x86_64"]) self.assertEqual(groups, ["core"]) @@ -1765,8 +1748,7 @@ class TestMakeLookasideRepo(helpers.PungiTestCase): def assertCorrect(self, repopath, path_prefix, MockCR, mock_run): with open(self.pkglist) as f: packages = f.read().splitlines() - six.assertCountEqual( - self, + self.assertCountEqual( packages, [ "pkg/pkg-1.0-1.x86_64.rpm", diff --git a/tests/test_gather_source_module.py b/tests/test_gather_source_module.py index fd44a0ec..93496eaf 100644 --- a/tests/test_gather_source_module.py +++ b/tests/test_gather_source_module.py @@ -2,8 +2,10 @@ import unittest -from unittest import mock -import six +try: + from unittest import mock +except ImportError: + import mock from pungi.phases.gather.sources.source_module import GatherSourceModule from tests import helpers @@ -51,8 +53,7 @@ class TestGatherSourceModule(helpers.PungiTestCase): source = GatherSourceModule(self.compose) packages, groups = source("x86_64", self.compose.variants["Server"]) - six.assertCountEqual( - self, + self.assertCountEqual( [(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)], ) diff --git a/tests/test_imagebuildphase.py b/tests/test_imagebuildphase.py index b3397f9a..6fbd457c 100644 --- a/tests/test_imagebuildphase.py +++ b/tests/test_imagebuildphase.py @@ -2,8 +2,6 @@ from unittest import mock -import six - import os from pungi.phases.image_build import ImageBuildPhase, CreateImageBuildThread @@ -99,8 +97,7 @@ class TestImageBuildPhase(PungiTestCase): "link_type": "hardlink-or-copy", "scratch": False, } - six.assertCountEqual( - self, + self.assertCountEqual( phase.pool.queue_put.mock_calls, [ mock.call((compose, client_args, phase.buildinstall_phase)), @@ -882,8 +879,7 @@ class TestCreateImageBuildThread(PungiTestCase): ], ) - six.assertCountEqual( - self, + self.assertCountEqual( linker.mock_calls, [ mock.call.link( diff --git a/tests/test_initphase.py b/tests/test_initphase.py index 0edf37b4..90a75728 100644 --- a/tests/test_initphase.py +++ b/tests/test_initphase.py @@ -8,8 +8,6 @@ try: except ImportError: import mock -import six - import os from pungi.module_util import Modulemd @@ -56,13 +54,11 @@ class TestInitPhase(PungiTestCase): self.assertEqual(write_global.mock_calls, [mock.call(compose)]) self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)]) - six.assertCountEqual( - self, + self.assertCountEqual( write_arch.mock_calls, [mock.call(compose, "x86_64"), mock.call(compose, "amd64")], ) - six.assertCountEqual( - self, + self.assertCountEqual( create_comps.mock_calls, [ mock.call(compose, "x86_64", None), @@ -75,8 +71,7 @@ class TestInitPhase(PungiTestCase): mock.call(compose, "x86_64", compose.all_variants["Server-optional"]), ], ) - six.assertCountEqual( - self, + self.assertCountEqual( write_variant.mock_calls, [ mock.call(compose, "x86_64", compose.variants["Server"]), @@ -117,13 +112,11 @@ class TestInitPhase(PungiTestCase): validate_comps.call_args_list, [mock.call(write_global.return_value)] ) self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)]) - six.assertCountEqual( - self, + self.assertCountEqual( write_arch.mock_calls, [mock.call(compose, "x86_64"), mock.call(compose, "amd64")], ) - six.assertCountEqual( - self, + self.assertCountEqual( create_comps.mock_calls, [ mock.call(compose, "x86_64", None), @@ -135,8 +128,7 @@ class TestInitPhase(PungiTestCase): mock.call(compose, "amd64", compose.variants["Everything"]), ], ) - six.assertCountEqual( - self, + self.assertCountEqual( write_variant.mock_calls, [ mock.call(compose, "x86_64", compose.variants["Server"]), diff --git a/tests/test_iso_wrapper.py b/tests/test_iso_wrapper.py index 8fec6438..28ea976e 100644 --- a/tests/test_iso_wrapper.py +++ b/tests/test_iso_wrapper.py @@ -3,7 +3,6 @@ import itertools from unittest import mock import os -import six import unittest from pungi.wrappers import iso @@ -41,7 +40,7 @@ def fake_listdir(pattern, result=None, exc=None): # The point of this is to avoid issues on Python 2, where apparently # isdir() is using listdir(), so the mocking is breaking it. def worker(path): - if isinstance(path, six.string_types) and pattern in path: + if isinstance(path, str) and pattern in path: if exc: raise exc return result diff --git a/tests/test_koji_wrapper.py b/tests/test_koji_wrapper.py index 7028a08f..015899c7 100644 --- a/tests/test_koji_wrapper.py +++ b/tests/test_koji_wrapper.py @@ -9,8 +9,6 @@ import tempfile import os import shutil -import six - from pungi.wrappers.kojiwrapper import KojiWrapper, get_buildroot_rpms from .helpers import FIXTURE_DIR @@ -94,13 +92,12 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): ) self.assertEqual(cmd[:3], ["koji", "--profile=custom-koji", "image-build"]) - six.assertCountEqual(self, cmd[3:], ["--config=" + self.tmpfile, "--wait"]) + self.assertCountEqual(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]") - six.assertCountEqual( - self, + self.assertCountEqual( lines[1:], [ "name = test-name", @@ -287,10 +284,9 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): ), ) result = self.koji.get_image_paths(12387273) - six.assertCountEqual(self, result.keys(), ["i386", "x86_64"]) + self.assertCountEqual(result.keys(), ["i386", "x86_64"]) self.maxDiff = None - six.assertCountEqual( - self, + self.assertCountEqual( result["i386"], [ "/koji/task/12387276/tdl-i386.xml", @@ -302,8 +298,7 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): "/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.raw.xz", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( result["x86_64"], [ "/koji/task/12387277/tdl-x86_64.xml", @@ -340,8 +335,8 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): result = self.koji.get_image_paths(25643870, callback=failed_callback) - six.assertCountEqual(self, result.keys(), ["aarch64", "armhfp", "x86_64"]) - six.assertCountEqual(self, failed, ["ppc64le", "s390x"]) + self.assertCountEqual(result.keys(), ["aarch64", "armhfp", "x86_64"]) + self.assertCountEqual(failed, ["ppc64le", "s390x"]) def test_multicall_map(self): self.koji.koji_proxy = mock.Mock() @@ -354,8 +349,7 @@ class KojiWrapperTest(KojiWrapperBaseTestCase): [{"x": 1}, {"x": 2}], ) - six.assertCountEqual( - self, + self.assertCountEqual( self.koji.koji_proxy.getBuild.mock_calls, [mock.call("foo", x=1), mock.call("bar", x=2)], ) @@ -419,8 +413,7 @@ class LiveMediaTestCase(KojiWrapperBaseTestCase): "--install-tree=/mnt/os", ], ) - six.assertCountEqual( - self, + self.assertCountEqual( cmd[9:], [ "--repo=repo-1", @@ -448,7 +441,7 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase): self.assertEqual( cmd[-1], "rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; date" ) - six.assertCountEqual(self, cmd[5:-3], []) + self.assertCountEqual(cmd[5:-3], []) def test_get_cmd_full(self): cmd = self.koji.get_runroot_cmd( @@ -469,8 +462,7 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase): cmd[-1], "rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo '&'", ) - six.assertCountEqual( - self, + self.assertCountEqual( cmd[4:-3], [ "--channel-override=chan", @@ -505,8 +497,7 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase): cmd[-1], "rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo '&' ; EXIT_CODE=$? ; chmod -R a+r '/output dir' /foo ; chown -R 1010 '/output dir' /foo ; exit $EXIT_CODE", # noqa: E501 ) - six.assertCountEqual( - self, + self.assertCountEqual( cmd[4:-3], [ "--channel-override=chan", @@ -641,8 +632,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): result = self.koji.run_blocking_cmd("cmd") self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234}) - six.assertCountEqual( - self, + self.assertCountEqual( run.mock_calls, [ mock.call( @@ -668,8 +658,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): result = self.koji.run_blocking_cmd("cmd") self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234}) - six.assertCountEqual( - self, + self.assertCountEqual( run.mock_calls, [ mock.call( @@ -696,8 +685,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): result = self.koji.run_blocking_cmd("cmd", log_file="logfile") self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234}) - six.assertCountEqual( - self, + self.assertCountEqual( run.mock_calls, [ mock.call( @@ -720,8 +708,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): result = self.koji.run_blocking_cmd("cmd") self.assertDictEqual(result, {"retcode": 1, "output": output, "task_id": 1234}) - six.assertCountEqual( - self, + self.assertCountEqual( run.mock_calls, [ mock.call( @@ -744,8 +731,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase): with self.assertRaises(RuntimeError) as ctx: self.koji.run_blocking_cmd("cmd") - six.assertCountEqual( - self, + self.assertCountEqual( run.mock_calls, [ mock.call( @@ -1113,8 +1099,7 @@ class TestGetBuildrootRPMs(unittest.TestCase): ], ) - six.assertCountEqual( - self, + self.assertCountEqual( rpms, [ "python3-kickstart-2.25-2.fc24.noarch", @@ -1131,8 +1116,7 @@ class TestGetBuildrootRPMs(unittest.TestCase): rpms = get_buildroot_rpms(compose, None) - six.assertCountEqual( - self, + self.assertCountEqual( rpms, [ "cjkuni-uming-fonts-0.2.20080216.1-56.fc23.noarch", diff --git a/tests/test_livemediaphase.py b/tests/test_livemediaphase.py index d2553788..18489fc0 100644 --- a/tests/test_livemediaphase.py +++ b/tests/test_livemediaphase.py @@ -4,8 +4,6 @@ from unittest import mock import os -import six - from pungi.phases.livemedia_phase import LiveMediaPhase, LiveMediaThread from tests.helpers import DummyCompose, PungiTestCase, boom @@ -579,8 +577,7 @@ 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 - six.assertCountEqual( - self, + self.assertCountEqual( link.mock_calls, [ mock.call( diff --git a/tests/test_lorax_wrapper.py b/tests/test_lorax_wrapper.py index bdbc400a..e8f8f8a6 100644 --- a/tests/test_lorax_wrapper.py +++ b/tests/test_lorax_wrapper.py @@ -2,8 +2,6 @@ import unittest -import six - from pungi.wrappers.lorax import LoraxWrapper @@ -17,8 +15,7 @@ class LoraxWrapperTest(unittest.TestCase): ) self.assertEqual(cmd[0], "lorax") - six.assertCountEqual( - self, + self.assertCountEqual( cmd[1:], [ "--product=product", @@ -56,8 +53,7 @@ class LoraxWrapperTest(unittest.TestCase): ) self.assertEqual(cmd[0], "lorax") - six.assertCountEqual( - self, + self.assertCountEqual( cmd[1:], [ "--product=product", diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 8aa86df3..a10ce4a0 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -1,8 +1,6 @@ from unittest import mock import os -import six - from tests import helpers from pungi import metadata @@ -131,8 +129,7 @@ class MediaRepoTestCase(helpers.PungiTestCase): with open(self.path) as f: lines = f.read().strip().split("\n") self.assertEqual(lines[0], "[InstallMedia]") - six.assertCountEqual( - self, + self.assertCountEqual( lines[1:], [ "name=Test 1.0", @@ -190,8 +187,7 @@ class TestPopulateExtraFiles(helpers.PungiTestCase): self.maxDiff = None - six.assertCountEqual( - self, + self.assertCountEqual( self.metadata.mock_calls, [ mock.call.add("Server", "x86_64", "Server/x86_64/os/foo", 3, FOO_MD5), @@ -210,8 +206,7 @@ class TestPopulateExtraFiles(helpers.PungiTestCase): self.metadata, self.variant, "x86_64", self.topdir, ["foo", "bar"], ["md5"] ) - six.assertCountEqual( - self, + self.assertCountEqual( self.metadata.mock_calls, [ mock.call.add("Server", "x86_64", "foo", 3, FOO_MD5), diff --git a/tests/test_ostree_installer_phase.py b/tests/test_ostree_installer_phase.py index 3d872345..7fa28ee0 100644 --- a/tests/test_ostree_installer_phase.py +++ b/tests/test_ostree_installer_phase.py @@ -3,12 +3,12 @@ from unittest import mock import os +import shlex from kobo.shortcuts import force_list from tests import helpers from pungi.phases import ostree_installer as ostree -from six.moves import shlex_quote LOG_PATH = "logs/x86_64/Everything/ostree_installer-1" @@ -144,7 +144,7 @@ class OstreeThreadTest(helpers.PungiTestCase): ] for s in force_list(sources): - lorax_cmd.append(shlex_quote("--source=%s" % s)) + lorax_cmd.append(shlex.quote("--source=%s" % s)) lorax_cmd.append("--variant=Everything") lorax_cmd.append("--nomacboot") diff --git a/tests/test_ostree_script.py b/tests/test_ostree_script.py index 04cc3619..10326c9c 100644 --- a/tests/test_ostree_script.py +++ b/tests/test_ostree_script.py @@ -4,8 +4,10 @@ import json import os -from unittest import mock -import six +try: + from unittest import mock +except ImportError: + import mock import yaml from tests import helpers @@ -50,8 +52,7 @@ class OstreeTreeScriptTest(helpers.PungiTestCase): ) def assertCorrectCall(self, mock_run, extra_calls=[], extra_args=[]): - six.assertCountEqual( - self, + self.assertCountEqual( mock_run.call_args_list, [ mock.call( @@ -393,8 +394,7 @@ class OstreeInstallerScriptTest(helpers.PungiTestCase): args.append("--add-arch-template-var=ostree_repo=http://www.example.com/ostree") ostree.main(args) self.maxDiff = None - six.assertCountEqual( - self, + self.assertCountEqual( run.mock_calls, [ mock.call( @@ -457,8 +457,7 @@ class OstreeInstallerScriptTest(helpers.PungiTestCase): args.append("--extra-config=%s" % extra_config_file) ostree.main(args) self.maxDiff = None - six.assertCountEqual( - self, + self.assertCountEqual( run.mock_calls, [ mock.call( diff --git a/tests/test_pkgset_common.py b/tests/test_pkgset_common.py index 7bd525ec..f4f8f7c5 100755 --- a/tests/test_pkgset_common.py +++ b/tests/test_pkgset_common.py @@ -2,8 +2,10 @@ import os -from unittest import mock -import six +try: + from unittest import mock +except ImportError: + import mock from pungi.module_util import Modulemd from pungi.phases.pkgset import common @@ -65,9 +67,7 @@ class TestMaterializedPkgsetCreate(helpers.PungiTestCase): self.compose, self.pkgset, self.prefix ) - six.assertCountEqual( - self, result.package_sets.keys(), ["global", "amd64", "x86_64"] - ) + self.assertCountEqual(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 135522be..c96c3359 100644 --- a/tests/test_pkgset_pkgsets.py +++ b/tests/test_pkgset_pkgsets.py @@ -3,7 +3,6 @@ import ddt from unittest import mock import os -import six import unittest import json @@ -127,7 +126,7 @@ class PkgsetCompareMixin(object): for k, v1 in expected.items(): self.assertIn(k, actual) v2 = actual.pop(k) - six.assertCountEqual(self, v1, v2) + self.assertCountEqual(v1, v2) self.assertEqual({}, actual) @@ -178,7 +177,7 @@ class TestKojiPkgset(PkgsetCompareMixin, helpers.PungiTestCase): for k, v1 in expected.items(): self.assertIn(k, actual) v2 = actual.pop(k) - six.assertCountEqual(self, v1, v2) + self.assertCountEqual(v1, v2) self.assertEqual({}, actual, msg="Some architectures were missing") @ddt.data( @@ -1360,6 +1359,6 @@ class TestSaveFileList(unittest.TestCase): with open(self.tmpfile) as f: rpms = f.read().strip().split("\n") - six.assertCountEqual( - self, rpms, ["pungi@4.1.3@3.fc25@noarch", "pungi@4.1.3@3.fc25@src"] + self.assertCountEqual( + 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 7a952e53..56488916 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -8,7 +8,6 @@ except ImportError: import mock import os import re -import six import unittest from ddt import ddt, data, unpack from typing import AnyStr, List, Set, Dict, Tuple @@ -61,8 +60,8 @@ class TestGetKojiEvent(helpers.PungiTestCase): event = source_koji.get_koji_event_info(self.compose, koji_wrapper) self.assertEqual(event, EVENT_INFO) - six.assertCountEqual( - self, koji_wrapper.mock_calls, [mock.call.koji_proxy.getEvent(123456)] + self.assertCountEqual( + koji_wrapper.mock_calls, [mock.call.koji_proxy.getEvent(123456)] ) with open(self.event_file) as f: self.assertEqual(json.load(f), EVENT_INFO) @@ -76,8 +75,8 @@ class TestGetKojiEvent(helpers.PungiTestCase): event = source_koji.get_koji_event_info(self.compose, koji_wrapper) self.assertEqual(event, EVENT_INFO) - six.assertCountEqual( - self, koji_wrapper.mock_calls, [mock.call.koji_proxy.getLastEvent()] + self.assertCountEqual( + koji_wrapper.mock_calls, [mock.call.koji_proxy.getLastEvent()] ) with open(self.event_file) as f: self.assertEqual(json.load(f), EVENT_INFO) @@ -150,15 +149,11 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase): self.assertEqual(len(pkgsets), 2) init_calls = KojiPackageSet.call_args_list - 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 - ) - six.assertCountEqual( - self, [call[0][2] for call in init_calls], [["foo", "bar"]] * 2 + self.assertCountEqual([call[0][0] for call in init_calls], ["f25", "f25-extra"]) + self.assertCountEqual( + [call[0][1] for call in init_calls], [self.koji_wrapper] * 2 ) + self.assertCountEqual([call[0][2] for call in init_calls], [["foo", "bar"]] * 2) pkgsets[0].assert_has_calls( [ @@ -196,7 +191,7 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase): self.compose, self.koji_wrapper, 123456 ) self.assertEqual(len(pkgsets), 1) - six.assertCountEqual(self, pkgsets[0].packages, ["pkg", "foo"]) + self.assertCountEqual(pkgsets[0].packages, ["pkg", "foo"]) class TestGetPackageSetFromKoji(helpers.PungiTestCase): @@ -214,8 +209,8 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase): def test_get_package_sets(self, pgp): pkgsets = source_koji.get_pkgset_from_koji(self.compose, self.koji_wrapper) - six.assertCountEqual( - self, self.koji_wrapper.koji_proxy.mock_calls, [mock.call.getLastEvent()] + self.assertCountEqual( + self.koji_wrapper.koji_proxy.mock_calls, [mock.call.getLastEvent()] ) self.assertEqual(pkgsets, pgp.return_value) @@ -498,12 +493,12 @@ class TestCorrectNVR(helpers.PungiTestCase): def test_nv(self): module_info = source_koji.variant_dict_from_str(self.compose, self.nv) expectedKeys = ["stream", "name"] - six.assertCountEqual(self, module_info.keys(), expectedKeys) + self.assertCountEqual(module_info.keys(), expectedKeys) def test_nvr(self): module_info = source_koji.variant_dict_from_str(self.compose, self.nvr) expectedKeys = ["stream", "name", "version"] - six.assertCountEqual(self, module_info.keys(), expectedKeys) + self.assertCountEqual(module_info.keys(), expectedKeys) def test_correct_release(self): module_info = source_koji.variant_dict_from_str(self.compose, self.nvr) @@ -580,7 +575,7 @@ class TestFilterInherited(unittest.TestCase): result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag) - six.assertCountEqual(self, result, [m1]) + self.assertCountEqual(result, [m1]) self.assertEqual( koji_proxy.mock_calls, [mock.call.getFullInheritance("top-tag", event=123456)], @@ -601,7 +596,7 @@ class TestFilterInherited(unittest.TestCase): result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag) - six.assertCountEqual(self, result, [m3]) + self.assertCountEqual(result, [m3]) self.assertEqual( koji_proxy.mock_calls, [mock.call.getFullInheritance("top-tag", event=123456)], @@ -621,7 +616,7 @@ class TestFilterInherited(unittest.TestCase): result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag) - six.assertCountEqual(self, result, [m]) + self.assertCountEqual(result, [m]) self.assertEqual( koji_proxy.mock_calls, [mock.call.getFullInheritance("top-tag", event=123456)], @@ -662,7 +657,7 @@ class TestFilterByWhitelist(unittest.TestCase): compose, module_builds, input_modules, expected ) - six.assertCountEqual(self, result, [module_builds[0], module_builds[1]]) + self.assertCountEqual(result, [module_builds[0], module_builds[1]]) self.assertEqual(expected, set()) def test_filter_by_NSV(self): @@ -714,7 +709,7 @@ class TestFilterByWhitelist(unittest.TestCase): compose, module_builds, input_modules, expected ) - six.assertCountEqual(self, result, module_builds) + self.assertCountEqual(result, module_builds) self.assertEqual(expected, set()) diff --git a/tests/test_repoclosure_phase.py b/tests/test_repoclosure_phase.py index 4fad10da..ef0f5b9b 100644 --- a/tests/test_repoclosure_phase.py +++ b/tests/test_repoclosure_phase.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from unittest import mock -import six import pungi.phases.repoclosure as repoclosure_phase from tests.helpers import DummyCompose, PungiTestCase, mk_boom @@ -35,8 +34,7 @@ class TestRepoclosure(PungiTestCase): compose = DummyCompose(self.topdir, {"repoclosure_backend": "dnf"}) repoclosure_phase.run_repoclosure(compose) - six.assertCountEqual( - self, + self.assertCountEqual( mock_grc.call_args_list, [ mock.call( @@ -89,8 +87,7 @@ class TestRepoclosure(PungiTestCase): repoclosure_phase.run_repoclosure(compose) self.assertEqual(mock_grc.call_args_list, []) - six.assertCountEqual( - self, + self.assertCountEqual( effl.call_args_list, [ mock.call([f], _log("amd64", "Everything")), @@ -129,8 +126,7 @@ class TestRepoclosure(PungiTestCase): ) repoclosure_phase.run_repoclosure(compose) - six.assertCountEqual( - self, + self.assertCountEqual( mock_grc.call_args_list, [ mock.call( diff --git a/tests/test_repoclosure_wrapper.py b/tests/test_repoclosure_wrapper.py index 6ea38b6a..2385b180 100755 --- a/tests/test_repoclosure_wrapper.py +++ b/tests/test_repoclosure_wrapper.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import os -import six from pungi.wrappers import repoclosure as rc @@ -26,8 +25,7 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase): backend="dnf", arch="x86_64", repos=repos, lookaside=lookaside ) self.assertEqual(cmd[:2], ["dnf", "repoclosure"]) - six.assertCountEqual( - self, + self.assertCountEqual( cmd[2:], [ "--arch=x86_64", @@ -51,8 +49,7 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase): lookaside=lookaside, ) self.assertEqual(cmd[:2], ["dnf", "repoclosure"]) - six.assertCountEqual( - self, + self.assertCountEqual( cmd[2:], [ "--arch=x86_64", diff --git a/tests/test_scm.py b/tests/test_scm.py index b41108c2..39f120d2 100644 --- a/tests/test_scm.py +++ b/tests/test_scm.py @@ -10,8 +10,6 @@ import unittest import http.server import threading -import six - from parameterized import parameterized from pungi.wrappers import scm @@ -28,7 +26,7 @@ class SCMBaseTest(unittest.TestCase): def assertStructure(self, returned, expected): # Check we returned the correct files - six.assertCountEqual(self, returned, expected) + self.assertCountEqual(returned, expected) # Each file must exist for f in expected: @@ -40,7 +38,7 @@ class SCMBaseTest(unittest.TestCase): for f in files: p = os.path.relpath(os.path.join(root, f), self.destdir) found.append(p) - six.assertCountEqual(self, expected, found) + self.assertCountEqual(expected, found) class FileSCMTestCase(SCMBaseTest): @@ -598,7 +596,7 @@ class RpmSCMTestCase(SCMBaseTest): ) self.assertStructure(retval, ["some-file-1.txt", "some-file-2.txt"]) - six.assertCountEqual(self, self.exploded, self.rpms) + self.assertCountEqual(self.exploded, self.rpms) @mock.patch("pungi.wrappers.scm.explode_rpm_package") def test_get_files_from_glob_rpms(self, explode): @@ -622,7 +620,7 @@ class RpmSCMTestCase(SCMBaseTest): "some-file-4.txt", ], ) - six.assertCountEqual(self, self.exploded, self.numbered) + self.assertCountEqual(self.exploded, self.numbered) @mock.patch("pungi.wrappers.scm.explode_rpm_package") def test_get_dir_from_two_rpms(self, explode): @@ -633,7 +631,7 @@ class RpmSCMTestCase(SCMBaseTest): ) self.assertStructure(retval, ["common/foo-1.txt", "common/foo-2.txt"]) - six.assertCountEqual(self, self.exploded, self.rpms) + self.assertCountEqual(self.exploded, self.rpms) @mock.patch("pungi.wrappers.scm.explode_rpm_package") def test_get_dir_from_glob_rpms(self, explode): @@ -651,7 +649,7 @@ class RpmSCMTestCase(SCMBaseTest): self.assertStructure( retval, ["foo-1.txt", "foo-2.txt", "foo-3.txt", "foo-4.txt"] ) - six.assertCountEqual(self, self.exploded, self.numbered) + self.assertCountEqual(self.exploded, self.numbered) class CvsSCMTestCase(SCMBaseTest): diff --git a/tests/test_unified_isos.py b/tests/test_unified_isos.py index 82bd4865..15deca06 100755 --- a/tests/test_unified_isos.py +++ b/tests/test_unified_isos.py @@ -3,8 +3,7 @@ from unittest import mock import os import shutil -import six -from six.moves.configparser import ConfigParser +from configparser import ConfigParser from tests.helpers import PungiTestCase, FIXTURE_DIR, touch, mk_boom from pungi_utils import unified_isos @@ -185,8 +184,7 @@ class TestLinkToTemp(PungiTestCase): def test_link_to_temp(self): self.isos.link_to_temp() - six.assertCountEqual( - self, + self.assertCountEqual( self.isos.treeinfo.keys(), [ "i386", @@ -202,8 +200,7 @@ class TestLinkToTemp(PungiTestCase): self.assertEqual(self.isos.productid, get_productid_mapping(self.compose_path)) self.assertEqual(self.isos.repos, get_repos_mapping(self.isos.temp_dir)) - six.assertCountEqual( - self, + self.assertCountEqual( self.isos.linker.link.call_args_list, [ self._linkCall( @@ -239,8 +236,7 @@ class TestLinkToTemp(PungiTestCase): with mock.patch("sys.stderr"): self.isos.link_to_temp() - six.assertCountEqual( - self, + self.assertCountEqual( self.isos.treeinfo.keys(), ["s390x", "src", "x86_64", "debug-s390x", "debug-x86_64"], ) @@ -257,8 +253,7 @@ class TestLinkToTemp(PungiTestCase): self.maxDiff = None - six.assertCountEqual( - self, + self.assertCountEqual( self.isos.linker.link.call_args_list, [ self._linkCall( @@ -290,8 +285,7 @@ class TestLinkToTemp(PungiTestCase): self.isos.link_to_temp() - six.assertCountEqual( - self, + self.assertCountEqual( self.isos.treeinfo.keys(), [ "i386", @@ -307,8 +301,7 @@ class TestLinkToTemp(PungiTestCase): self.assertEqual(self.isos.productid, get_productid_mapping(self.compose_path)) self.assertEqual(self.isos.repos, get_repos_mapping(self.isos.temp_dir)) - six.assertCountEqual( - self, + self.assertCountEqual( self.isos.linker.link.call_args_list, [ self._linkCall( @@ -372,8 +365,7 @@ class TestCreaterepo(PungiTestCase): cr.return_value.get_createrepo_cmd.side_effect = self.mock_cr self.isos.createrepo() - six.assertCountEqual( - self, + self.assertCountEqual( run.call_args_list, [ mock.call(("src/Client", None), show_cmd=True), @@ -430,8 +422,7 @@ class TestCreaterepo(PungiTestCase): cr.return_value.get_modifyrepo_cmd.side_effect = self.mock_mr self.isos.createrepo() - six.assertCountEqual( - self, + self.assertCountEqual( run.call_args_list, [ mock.call(("src/Client", None), show_cmd=True), @@ -527,8 +518,7 @@ class TestDiscinfo(PungiTestCase): @mock.patch("pungi_utils.unified_isos.create_discinfo") def test_discinfo(self, create_discinfo): self.isos.discinfo() - six.assertCountEqual( - self, + self.assertCountEqual( create_discinfo.call_args_list, [ mock.call( @@ -687,7 +677,7 @@ class TestCreateiso(PungiTestCase): ), ] ) - six.assertCountEqual(self, self.isos.linker.link.call_args_list, expected) + self.assertCountEqual(self.isos.linker.link.call_args_list, expected) @mock.patch("pungi_utils.unified_isos.iso") @mock.patch("pungi_utils.unified_isos.run") @@ -758,8 +748,7 @@ class TestUpdateChecksums(PungiTestCase): @mock.patch("pungi_utils.unified_isos.make_checksums") def test_update_checksums(self, mmc): self.isos.update_checksums() - six.assertCountEqual( - self, + self.assertCountEqual( mmc.call_args_list, [ mock.call( @@ -776,8 +765,7 @@ class TestUpdateChecksums(PungiTestCase): def test_update_checksums_one_file(self, mmc): self.isos.conf["media_checksum_one_file"] = True self.isos.update_checksums() - six.assertCountEqual( - self, + self.assertCountEqual( mmc.call_args_list, [ mock.call( diff --git a/tests/test_util.py b/tests/test_util.py index 3ecab4a3..9040c122 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -8,7 +8,6 @@ import unittest import tempfile import shutil import subprocess -import six from pungi import compose from pungi import util @@ -251,7 +250,7 @@ class TestGetVariantData(unittest.TestCase): def test_get_make_list(self): conf = {"foo": {"^Client$": [1, 2], "^.*$": 3}} result = util.get_variant_data(conf, "foo", mock.Mock(uid="Client")) - six.assertCountEqual(self, result, [1, 2, 3]) + self.assertCountEqual(result, [1, 2, 3]) def test_not_matching_arch(self): conf = {"foo": {"^Client$": [1, 2]}} @@ -1050,7 +1049,7 @@ class TestMoveAll(PungiTestCase): self.assertFalse(os.path.isfile(os.path.join(self.src, "target"))) -@mock.patch("six.moves.urllib.request.urlretrieve") +@mock.patch("urllib.request.urlretrieve") class TestAsLocalFile(PungiTestCase): def test_local_file(self, urlretrieve): with util.as_local_file("/tmp/foo") as fn: diff --git a/tests/test_variant_wrapper.py b/tests/test_variant_wrapper.py index 1a035f5e..a90c1386 100644 --- a/tests/test_variant_wrapper.py +++ b/tests/test_variant_wrapper.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import unittest -from six.moves import cStringIO +from io import StringIO from pungi.wrappers.variants import VariantsXmlParser @@ -18,7 +18,7 @@ VARIANTS_WITH_WHITESPACE = """ class TestVariantsXmlParser(unittest.TestCase): def test_whitespace_in_file(self): - input = cStringIO(VARIANTS_WITH_WHITESPACE) + input = StringIO(VARIANTS_WITH_WHITESPACE) with self.assertRaises(ValueError) as ctx: VariantsXmlParser(input)