Drop usage of six
We no longer need to support Python 2, so there's no point in this compatibility layer. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com> (cherry picked from commit b34de57813187f1781aef733468c9745a144d9af)
This commit is contained in:
parent
b044ebdba1
commit
4ff13b1993
@ -42,7 +42,6 @@ import platform
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
import jsonschema
|
import jsonschema
|
||||||
import six
|
|
||||||
from kobo.shortcuts import force_list
|
from kobo.shortcuts import force_list
|
||||||
from pungi.phases import PHASES_NAMES
|
from pungi.phases import PHASES_NAMES
|
||||||
from pungi.runroot import RUNROOT_TYPES
|
from pungi.runroot import RUNROOT_TYPES
|
||||||
@ -236,8 +235,8 @@ def validate(config, offline=False, schema=None):
|
|||||||
schema,
|
schema,
|
||||||
{
|
{
|
||||||
"array": (tuple, list),
|
"array": (tuple, list),
|
||||||
"regex": six.string_types,
|
"regex": str,
|
||||||
"url": six.string_types,
|
"url": str,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
errors = []
|
errors = []
|
||||||
@ -462,7 +461,7 @@ def _extend_with_default_and_alias(validator_class, offline=False):
|
|||||||
return isinstance(instance, (tuple, list))
|
return isinstance(instance, (tuple, list))
|
||||||
|
|
||||||
def is_string_type(checker, instance):
|
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(
|
kwargs["type_checker"] = validator_class.TYPE_CHECKER.redefine_many(
|
||||||
{"array": is_array, "regex": is_string_type, "url": is_string_type}
|
{"array": is_array, "regex": is_string_type, "url": is_string_type}
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import six
|
import shlex
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from kobo.shortcuts import run
|
from kobo.shortcuts import run
|
||||||
from six.moves import shlex_quote
|
|
||||||
|
|
||||||
from .wrappers import iso
|
from .wrappers import iso
|
||||||
from .wrappers.jigdo import JigdoWrapper
|
from .wrappers.jigdo import JigdoWrapper
|
||||||
@ -41,13 +40,13 @@ def quote(str):
|
|||||||
expanded.
|
expanded.
|
||||||
"""
|
"""
|
||||||
if str.startswith("$TEMPLATE"):
|
if str.startswith("$TEMPLATE"):
|
||||||
return "$TEMPLATE%s" % shlex_quote(str.replace("$TEMPLATE", "", 1))
|
return "$TEMPLATE%s" % shlex.quote(str.replace("$TEMPLATE", "", 1))
|
||||||
return shlex_quote(str)
|
return shlex.quote(str)
|
||||||
|
|
||||||
|
|
||||||
def emit(f, cmd):
|
def emit(f, cmd):
|
||||||
"""Print line of shell code into the stream."""
|
"""Print line of shell code into the stream."""
|
||||||
if isinstance(cmd, six.string_types):
|
if isinstance(cmd, str):
|
||||||
print(cmd, file=f)
|
print(cmd, file=f)
|
||||||
else:
|
else:
|
||||||
print(" ".join([quote(x) for x in cmd]), file=f)
|
print(" ".join([quote(x) for x in cmd]), file=f)
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import six
|
import shlex
|
||||||
from six.moves import shlex_quote
|
|
||||||
|
|
||||||
|
|
||||||
from .base import OSTree
|
from .base import OSTree
|
||||||
@ -26,10 +25,10 @@ from .utils import tweak_treeconf
|
|||||||
|
|
||||||
def emit(cmd):
|
def emit(cmd):
|
||||||
"""Print line of shell code into the stream."""
|
"""Print line of shell code into the stream."""
|
||||||
if isinstance(cmd, six.string_types):
|
if isinstance(cmd, str):
|
||||||
print(cmd)
|
print(cmd)
|
||||||
else:
|
else:
|
||||||
print(" ".join([shlex_quote(x) for x in cmd]))
|
print(" ".join([shlex.quote(x) for x in cmd]))
|
||||||
|
|
||||||
|
|
||||||
class Container(OSTree):
|
class Container(OSTree):
|
||||||
|
@ -16,17 +16,17 @@
|
|||||||
|
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
|
import pickle
|
||||||
import time
|
import time
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
from six.moves import cPickle as pickle
|
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
|
||||||
from kobo.threads import ThreadPool, WorkerThread
|
from kobo.threads import ThreadPool, WorkerThread
|
||||||
from kobo.shortcuts import run, force_list
|
from kobo.shortcuts import run, force_list
|
||||||
import kobo.rpmlib
|
import kobo.rpmlib
|
||||||
from productmd.images import Image
|
from productmd.images import Image
|
||||||
from six.moves import shlex_quote
|
|
||||||
|
|
||||||
from pungi.arch import get_valid_arches
|
from pungi.arch import get_valid_arches
|
||||||
from pungi.util import get_volid, get_arch_variant_data
|
from pungi.util import get_volid, get_arch_variant_data
|
||||||
@ -207,8 +207,8 @@ class BuildinstallPhase(PhaseBase):
|
|||||||
configuration_file=configuration_file,
|
configuration_file=configuration_file,
|
||||||
)
|
)
|
||||||
return "rm -rf %s && %s" % (
|
return "rm -rf %s && %s" % (
|
||||||
shlex_quote(output_topdir),
|
shlex.quote(output_topdir),
|
||||||
" ".join([shlex_quote(x) for x in lorax_cmd]),
|
" ".join([shlex.quote(x) for x in lorax_cmd]),
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_repos(self, arch):
|
def get_repos(self, arch):
|
||||||
@ -413,8 +413,8 @@ def tweak_buildinstall(
|
|||||||
# copy src to temp
|
# copy src to temp
|
||||||
# TODO: place temp on the same device as buildinstall dir so we can hardlink
|
# 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/" % (
|
cmd = "cp -dRv --preserve=mode,links,timestamps --remove-destination %s/* %s/" % (
|
||||||
shlex_quote(src),
|
shlex.quote(src),
|
||||||
shlex_quote(tmp_dir),
|
shlex.quote(tmp_dir),
|
||||||
)
|
)
|
||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
@ -452,12 +452,12 @@ def tweak_buildinstall(
|
|||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
# HACK: make buildinstall files world readable
|
# 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
|
# copy temp to dst
|
||||||
cmd = "cp -dRv --preserve=mode,links,timestamps --remove-destination %s/* %s/" % (
|
cmd = "cp -dRv --preserve=mode,links,timestamps --remove-destination %s/* %s/" % (
|
||||||
shlex_quote(tmp_dir),
|
shlex.quote(tmp_dir),
|
||||||
shlex_quote(dst),
|
shlex.quote(dst),
|
||||||
)
|
)
|
||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import stat
|
import stat
|
||||||
import json
|
import json
|
||||||
@ -25,7 +26,6 @@ import productmd.treeinfo
|
|||||||
from productmd.images import Image
|
from productmd.images import Image
|
||||||
from kobo.threads import ThreadPool, WorkerThread
|
from kobo.threads import ThreadPool, WorkerThread
|
||||||
from kobo.shortcuts import run, relative_path, compute_file_checksums
|
from kobo.shortcuts import run, relative_path, compute_file_checksums
|
||||||
from six.moves import shlex_quote
|
|
||||||
|
|
||||||
from pungi.wrappers import iso
|
from pungi.wrappers import iso
|
||||||
from pungi.wrappers.createrepo import CreaterepoWrapper
|
from pungi.wrappers.createrepo import CreaterepoWrapper
|
||||||
@ -782,7 +782,7 @@ def prepare_iso(
|
|||||||
|
|
||||||
if file_list_content:
|
if file_list_content:
|
||||||
# write modified repodata only if there are packages available
|
# 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:
|
with open(file_list, "w") as f:
|
||||||
f.write("\n".join(file_list_content))
|
f.write("\n".join(file_list_content))
|
||||||
cmd = repo.get_createrepo_cmd(
|
cmd = repo.get_createrepo_cmd(
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import pickle
|
||||||
import shutil
|
import shutil
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
@ -24,7 +25,6 @@ from kobo.rpmlib import parse_nvra
|
|||||||
from kobo.shortcuts import run
|
from kobo.shortcuts import run
|
||||||
from productmd.rpms import Rpms
|
from productmd.rpms import Rpms
|
||||||
from pungi.phases.pkgset.common import get_all_arches
|
from pungi.phases.pkgset.common import get_all_arches
|
||||||
from six.moves import cPickle as pickle
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
import os
|
import os
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
import re
|
import re
|
||||||
import six
|
|
||||||
|
|
||||||
import pungi.arch
|
import pungi.arch
|
||||||
from pungi.util import pkg_is_rpm, pkg_is_srpm, pkg_is_debug
|
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):
|
if not pkg_is_rpm(pkg):
|
||||||
continue
|
continue
|
||||||
for gathered_pkg, pkg_arch in packages:
|
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(".", "\\.")
|
gathered_pkg.replace(".", "\\.")
|
||||||
.replace("+", "\\+")
|
.replace("+", "\\+")
|
||||||
.replace("*", ".*")
|
.replace("*", ".*")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import configparser
|
||||||
import copy
|
import copy
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import json
|
import json
|
||||||
@ -7,7 +8,6 @@ import os
|
|||||||
from kobo.threads import ThreadPool, WorkerThread
|
from kobo.threads import ThreadPool, WorkerThread
|
||||||
from kobo import shortcuts
|
from kobo import shortcuts
|
||||||
from productmd.rpms import Rpms
|
from productmd.rpms import Rpms
|
||||||
from six.moves import configparser
|
|
||||||
|
|
||||||
from .base import ConfigGuardedPhase, PhaseLoggerMixin
|
from .base import ConfigGuardedPhase, PhaseLoggerMixin
|
||||||
from .. import util
|
from .. import util
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from kobo.threads import ThreadPool, WorkerThread
|
from kobo.threads import ThreadPool, WorkerThread
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
from productmd import images
|
from productmd import images
|
||||||
from six.moves import shlex_quote
|
|
||||||
from kobo import shortcuts
|
from kobo import shortcuts
|
||||||
|
|
||||||
from .base import ConfigGuardedPhase, PhaseLoggerMixin
|
from .base import ConfigGuardedPhase, PhaseLoggerMixin
|
||||||
@ -275,8 +275,8 @@ class OstreeInstallerThread(WorkerThread):
|
|||||||
skip_branding=config.get("skip_branding"),
|
skip_branding=config.get("skip_branding"),
|
||||||
)
|
)
|
||||||
cmd = "rm -rf %s && %s" % (
|
cmd = "rm -rf %s && %s" % (
|
||||||
shlex_quote(output_dir),
|
shlex.quote(output_dir),
|
||||||
" ".join([shlex_quote(x) for x in lorax_cmd]),
|
" ".join([shlex.quote(x) for x in lorax_cmd]),
|
||||||
)
|
)
|
||||||
|
|
||||||
runroot.run(
|
runroot.run(
|
||||||
|
@ -22,10 +22,10 @@ It automatically finds a signed copies according to *sigkey_ordering*.
|
|||||||
import itertools
|
import itertools
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import pickle
|
||||||
import time
|
import time
|
||||||
import pgpy
|
import pgpy
|
||||||
import rpm
|
import rpm
|
||||||
from six.moves import cPickle as pickle
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import kobo.log
|
import kobo.log
|
||||||
|
@ -16,12 +16,11 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import six
|
|
||||||
from six.moves import shlex_quote
|
|
||||||
import kobo.log
|
import kobo.log
|
||||||
from kobo.shortcuts import run
|
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
|
formatted_cmd = command.format(**fmt_dict) if fmt_dict else command
|
||||||
ssh_cmd = ["ssh", "-oBatchMode=yes", "-n", "-l", user, hostname, formatted_cmd]
|
ssh_cmd = ["ssh", "-oBatchMode=yes", "-n", "-l", user, hostname, formatted_cmd]
|
||||||
output = run(ssh_cmd, show_cmd=True, logfile=log_file)[1]
|
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()
|
return output.decode()
|
||||||
else:
|
else:
|
||||||
return output
|
return output
|
||||||
@ -184,7 +183,7 @@ class Runroot(kobo.log.LoggingBase):
|
|||||||
# If the output dir is defined, change the permissions of files generated
|
# If the output dir is defined, change the permissions of files generated
|
||||||
# by the runroot task, so the Pungi user can access them.
|
# by the runroot task, so the Pungi user can access them.
|
||||||
if chown_paths:
|
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=$?"
|
command += " ; EXIT_CODE=$?"
|
||||||
# Make the files world readable
|
# Make the files world readable
|
||||||
command += " ; chmod -R a+r %s" % paths
|
command += " ; chmod -R a+r %s" % paths
|
||||||
|
@ -4,13 +4,12 @@ from __future__ import absolute_import
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import configparser
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from six.moves import configparser
|
|
||||||
|
|
||||||
import kobo.conf
|
import kobo.conf
|
||||||
import pungi.checks
|
import pungi.checks
|
||||||
import pungi.util
|
import pungi.util
|
||||||
|
@ -8,8 +8,6 @@ import json
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
import pungi.checks
|
import pungi.checks
|
||||||
import pungi.compose
|
import pungi.compose
|
||||||
import pungi.paths
|
import pungi.paths
|
||||||
@ -56,7 +54,7 @@ class ValidationCompose(pungi.compose.Compose):
|
|||||||
def read_variants(compose, config):
|
def read_variants(compose, config):
|
||||||
with pungi.util.temp_dir() as tmp_dir:
|
with pungi.util.temp_dir() as tmp_dir:
|
||||||
scm_dict = compose.conf["variants_file"]
|
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)
|
config_dir = os.path.dirname(config)
|
||||||
scm_dict = os.path.join(config_dir, scm_dict)
|
scm_dict = os.path.join(config_dir, scm_dict)
|
||||||
files = pungi.wrappers.scm.get_file_from_scm(scm_dict, tmp_dir)
|
files = pungi.wrappers.scm.get_file_from_scm(scm_dict, tmp_dir)
|
||||||
|
@ -11,14 +11,13 @@ import locale
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
|
import shlex
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from six.moves import shlex_quote
|
|
||||||
|
|
||||||
from pungi.phases import PHASES_NAMES
|
from pungi.phases import PHASES_NAMES
|
||||||
from pungi import get_full_version, util
|
from pungi import get_full_version, util
|
||||||
from pungi.errors import UnsignedPackagesError
|
from pungi.errors import UnsignedPackagesError
|
||||||
@ -386,7 +385,7 @@ def run_compose(
|
|||||||
compose.log_info("User name: %s" % getpass.getuser())
|
compose.log_info("User name: %s" % getpass.getuser())
|
||||||
compose.log_info("Working directory: %s" % os.getcwd())
|
compose.log_info("Working directory: %s" % os.getcwd())
|
||||||
compose.log_info(
|
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("Compose top directory: %s" % compose.topdir)
|
||||||
compose.log_info("Current timezone offset: %s" % pungi.util.get_tz_offset())
|
compose.log_info("Current timezone offset: %s" % pungi.util.get_tz_offset())
|
||||||
|
@ -24,11 +24,13 @@ import hashlib
|
|||||||
import errno
|
import errno
|
||||||
import re
|
import re
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import shlex
|
||||||
import traceback
|
import traceback
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.request
|
||||||
import functools
|
import functools
|
||||||
from six.moves import urllib, range, shlex_quote
|
|
||||||
|
|
||||||
import kobo.conf
|
import kobo.conf
|
||||||
from kobo.shortcuts import run, force_list
|
from kobo.shortcuts import run, force_list
|
||||||
@ -193,14 +195,14 @@ def explode_rpm_package(pkg_path, target_dir):
|
|||||||
try:
|
try:
|
||||||
# rpm2archive writes to stdout only if reading from stdin, thus the redirect
|
# rpm2archive writes to stdout only if reading from stdin, thus the redirect
|
||||||
run(
|
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,
|
workdir=target_dir,
|
||||||
)
|
)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
# Fall back to rpm2cpio in case rpm2archive failed (most likely due to
|
# Fall back to rpm2cpio in case rpm2archive failed (most likely due to
|
||||||
# not being present on the system).
|
# not being present on the system).
|
||||||
run(
|
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,
|
workdir=target_dir,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import shlex
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
import contextlib
|
import contextlib
|
||||||
from six.moves import shlex_quote
|
|
||||||
|
|
||||||
from kobo.shortcuts import force_list, relative_path, run
|
from kobo.shortcuts import force_list, relative_path, run
|
||||||
from pungi import util
|
from pungi import util
|
||||||
@ -270,13 +270,13 @@ def get_manifest_cmd(iso_name, xorriso=False, output_file=None):
|
|||||||
tr -d "'" |
|
tr -d "'" |
|
||||||
cut -c2- |
|
cut -c2- |
|
||||||
sort >> %s""" % (
|
sort >> %s""" % (
|
||||||
shlex_quote(iso_name),
|
shlex.quote(iso_name),
|
||||||
shlex_quote(output_file),
|
shlex.quote(output_file),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return "isoinfo -R -f -i %s | grep -v '/TRANS.TBL$' | sort >> %s" % (
|
return "isoinfo -R -f -i %s | grep -v '/TRANS.TBL$' | sort >> %s" % (
|
||||||
shlex_quote(iso_name),
|
shlex.quote(iso_name),
|
||||||
shlex_quote(output_file),
|
shlex.quote(output_file),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,21 +14,21 @@
|
|||||||
# along with this program; if not, see <https://gnu.org/licenses/>.
|
# along with this program; if not, see <https://gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
import configparser
|
||||||
import contextlib
|
import contextlib
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
|
import xmlrpc.client
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import koji
|
import koji
|
||||||
from kobo.shortcuts import run, force_list
|
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 flufl.lock import Lock
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class KojiWrapper(object):
|
|||||||
|
|
||||||
# This retry should be removed once https://pagure.io/koji/issue/3170 is
|
# This retry should be removed once https://pagure.io/koji/issue/3170 is
|
||||||
# fixed and released.
|
# fixed and released.
|
||||||
@util.retry(wait_on=(xmlrpclib.ProtocolError, koji.GenericError))
|
@util.retry(wait_on=(xmlrpc.client.ProtocolError, koji.GenericError))
|
||||||
def login(self):
|
def login(self):
|
||||||
"""Authenticate to the hub."""
|
"""Authenticate to the hub."""
|
||||||
auth_type = self.koji_module.config.authtype
|
auth_type = self.koji_module.config.authtype
|
||||||
@ -145,7 +145,7 @@ class KojiWrapper(object):
|
|||||||
cmd.append(arch)
|
cmd.append(arch)
|
||||||
|
|
||||||
if isinstance(command, list):
|
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
|
# HACK: remove rpmdb and yum cache
|
||||||
command = (
|
command = (
|
||||||
@ -153,7 +153,7 @@ class KojiWrapper(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if chown_paths:
|
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=$?"
|
command += " ; EXIT_CODE=$?"
|
||||||
# Make the files world readable
|
# Make the files world readable
|
||||||
command += " ; chmod -R a+r %s" % paths
|
command += " ; chmod -R a+r %s" % paths
|
||||||
@ -359,7 +359,7 @@ class KojiWrapper(object):
|
|||||||
for option, value in opts.items():
|
for option, value in opts.items():
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
value = ",".join(value)
|
value = ",".join(value)
|
||||||
if not isinstance(value, six.string_types):
|
if not isinstance(value, str):
|
||||||
# Python 3 configparser will reject non-string values.
|
# Python 3 configparser will reject non-string values.
|
||||||
value = str(value)
|
value = str(value)
|
||||||
cfg_parser.set(section, option, value)
|
cfg_parser.set(section, option, value)
|
||||||
@ -765,11 +765,11 @@ class KojiWrapper(object):
|
|||||||
|
|
||||||
return results
|
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):
|
def retrying_multicall_map(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Retrying version of multicall_map. This tries to retry the Koji call
|
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.
|
Please refer to koji_multicall_map for further specification of arguments.
|
||||||
"""
|
"""
|
||||||
|
@ -19,10 +19,9 @@ from __future__ import absolute_import
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import glob
|
import glob
|
||||||
import six
|
import shlex
|
||||||
import threading
|
import threading
|
||||||
from six.moves import shlex_quote
|
from urllib.request import urlretrieve
|
||||||
from six.moves.urllib.request import urlretrieve
|
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
|
|
||||||
import kobo.log
|
import kobo.log
|
||||||
@ -285,8 +284,8 @@ class RpmScmWrapper(ScmBase):
|
|||||||
run(
|
run(
|
||||||
"cp -a %s %s/"
|
"cp -a %s %s/"
|
||||||
% (
|
% (
|
||||||
shlex_quote(os.path.join(tmp_dir, scm_dir)),
|
shlex.quote(os.path.join(tmp_dir, scm_dir)),
|
||||||
shlex_quote(target_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)
|
>>> get_file_from_scm(scm_dict, target_path)
|
||||||
['/tmp/path/share/variants.dtd']
|
['/tmp/path/share/variants.dtd']
|
||||||
"""
|
"""
|
||||||
if isinstance(scm_dict, six.string_types):
|
if isinstance(scm_dict, str):
|
||||||
scm_type = "file"
|
scm_type = "file"
|
||||||
scm_repo = None
|
scm_repo = None
|
||||||
scm_file = os.path.abspath(scm_dict)
|
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)
|
>>> get_dir_from_scm(scm_dict, target_path)
|
||||||
['/tmp/path/share/variants.dtd', '/tmp/path/share/rawhide-fedora.ks', ...]
|
['/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_type = "file"
|
||||||
scm_repo = None
|
scm_repo = None
|
||||||
scm_dir = os.path.abspath(scm_dict)
|
scm_dir = os.path.abspath(scm_dict)
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
from kobo import shortcuts
|
from kobo import shortcuts
|
||||||
import os
|
import os
|
||||||
import productmd
|
import productmd
|
||||||
|
import shlex
|
||||||
import tempfile
|
import tempfile
|
||||||
from six.moves import shlex_quote
|
|
||||||
|
|
||||||
from pungi import util
|
from pungi import util
|
||||||
from pungi.phases.buildinstall import tweak_configs
|
from pungi.phases.buildinstall import tweak_configs
|
||||||
@ -24,7 +24,7 @@ from pungi.wrappers import iso
|
|||||||
|
|
||||||
|
|
||||||
def sh(log, cmd, *args, **kwargs):
|
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)
|
ret, out = shortcuts.run(cmd, *args, universal_newlines=True, **kwargs)
|
||||||
if out:
|
if out:
|
||||||
log.debug("%s", out)
|
log.debug("%s", out)
|
||||||
|
1
setup.py
1
setup.py
@ -61,7 +61,6 @@ setup(
|
|||||||
"kobo",
|
"kobo",
|
||||||
"lxml",
|
"lxml",
|
||||||
"productmd>=1.23",
|
"productmd>=1.23",
|
||||||
"six",
|
|
||||||
"dogpile.cache",
|
"dogpile.cache",
|
||||||
],
|
],
|
||||||
extras_require={':python_version=="2.7"': ["enum34", "lockfile"]},
|
extras_require={':python_version=="2.7"': ["enum34", "lockfile"]},
|
||||||
|
@ -8,8 +8,10 @@ import shutil
|
|||||||
import tempfile
|
import tempfile
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from unittest import mock
|
try:
|
||||||
import six
|
from unittest import mock
|
||||||
|
except ImportError:
|
||||||
|
import mock
|
||||||
from kobo.rpmlib import parse_nvr
|
from kobo.rpmlib import parse_nvr
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
@ -303,7 +305,7 @@ def touch(path, content=None, mode=None):
|
|||||||
os.makedirs(os.path.dirname(path))
|
os.makedirs(os.path.dirname(path))
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
if not isinstance(content, six.binary_type):
|
if not isinstance(content, bytes):
|
||||||
content = content.encode()
|
content = content.encode()
|
||||||
with open(path, "wb") as f:
|
with open(path, "wb") as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
@ -1,22 +1,18 @@
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
import io
|
||||||
import unittest
|
import unittest
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.scripts.pungi_koji import cli_main
|
from pungi.scripts.pungi_koji import cli_main
|
||||||
|
|
||||||
|
|
||||||
class PungiKojiTestCase(unittest.TestCase):
|
class PungiKojiTestCase(unittest.TestCase):
|
||||||
@mock.patch("sys.argv", new=["prog", "--version"])
|
@mock.patch("sys.argv", new=["prog", "--version"])
|
||||||
@mock.patch("sys.stderr", new_callable=six.StringIO)
|
@mock.patch("sys.stderr", new_callable=io.StringIO)
|
||||||
@mock.patch("sys.stdout", new_callable=six.StringIO)
|
@mock.patch("sys.stdout", new_callable=io.StringIO)
|
||||||
@mock.patch("pungi.scripts.pungi_koji.get_full_version", return_value="a-b-c.111")
|
@mock.patch("pungi.scripts.pungi_koji.get_full_version", return_value="a-b-c.111")
|
||||||
def test_version(self, get_full_version, stdout, stderr):
|
def test_version(self, get_full_version, stdout, stderr):
|
||||||
with self.assertRaises(SystemExit) as cm:
|
with self.assertRaises(SystemExit) as cm:
|
||||||
cli_main()
|
cli_main()
|
||||||
self.assertEqual(cm.exception.code, 0)
|
self.assertEqual(cm.exception.code, 0)
|
||||||
# Python 2.7 prints the version to stderr, 3.4+ to stdout.
|
self.assertMultiLineEqual(stdout.getvalue(), "a-b-c.111\n")
|
||||||
if six.PY3:
|
|
||||||
self.assertMultiLineEqual(stdout.getvalue(), "a-b-c.111\n")
|
|
||||||
else:
|
|
||||||
self.assertMultiLineEqual(stderr.getvalue(), "a-b-c.111\n")
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import unittest
|
try:
|
||||||
|
from unittest import mock
|
||||||
from unittest import mock
|
except ImportError:
|
||||||
import six
|
import mock
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from six.moves import StringIO
|
from io import StringIO
|
||||||
from ddt import ddt, data
|
from ddt import ddt, data
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -117,8 +117,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
# Server.x86_64, Client.amd64, Server.x86_64
|
# Server.x86_64, Client.amd64, Server.x86_64
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
[
|
[
|
||||||
"rm -rf %s/work/amd64/buildinstall/Client && lorax ..." % self.topdir,
|
"rm -rf %s/work/amd64/buildinstall/Client && lorax ..." % self.topdir,
|
||||||
@ -128,8 +127,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Obtained correct lorax commands.
|
# Obtained correct lorax commands.
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -221,8 +219,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -361,14 +358,12 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
# Server.x86_64, Client.amd64, Server.x86_64
|
# Server.x86_64, Client.amd64, Server.x86_64
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
expected_args,
|
expected_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -520,8 +515,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
# Server.x86_64, Client.amd64, Server.x86_64
|
# Server.x86_64, Client.amd64, Server.x86_64
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
[
|
[
|
||||||
"rm -rf %s/work/amd64/buildinstall/Client && lorax ..." % self.topdir,
|
"rm -rf %s/work/amd64/buildinstall/Client && lorax ..." % self.topdir,
|
||||||
@ -531,8 +525,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Obtained correct lorax commands.
|
# Obtained correct lorax commands.
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -627,8 +620,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -655,8 +647,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
There should be one get_file call. This is because the configuration_file
|
There should be one get_file call. This is because the configuration_file
|
||||||
option was used only once in the above configuration.
|
option was used only once in the above configuration.
|
||||||
"""
|
"""
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
get_file.mock_calls,
|
get_file.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -703,8 +694,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
# Server.x86_64, Client.amd64, Server.x86_64
|
# Server.x86_64, Client.amd64, Server.x86_64
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
[
|
[
|
||||||
"rm -rf %s/work/amd64/buildinstall/Client && lorax ..." % self.topdir,
|
"rm -rf %s/work/amd64/buildinstall/Client && lorax ..." % self.topdir,
|
||||||
@ -714,8 +704,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Obtained correct lorax commands.
|
# Obtained correct lorax commands.
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -804,8 +793,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -862,8 +850,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
# Server.x86_64, Client.amd64, Server.x86_64
|
# Server.x86_64, Client.amd64, Server.x86_64
|
||||||
pool = poolCls.return_value
|
pool = poolCls.return_value
|
||||||
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
self.assertEqual(3, len(pool.queue_put.mock_calls))
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
[call[0][0][3] for call in pool.queue_put.call_args_list],
|
||||||
[
|
[
|
||||||
"rm -rf %s/amd64/Client && lorax ..." % buildinstall_topdir,
|
"rm -rf %s/amd64/Client && lorax ..." % buildinstall_topdir,
|
||||||
@ -873,8 +860,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Obtained correct lorax commands.
|
# Obtained correct lorax commands.
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -963,8 +949,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
get_volid.mock_calls,
|
get_volid.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -1023,8 +1008,7 @@ class TestBuildinstallPhase(PungiTestCase):
|
|||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
loraxCls.return_value.get_lorax_cmd.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -1202,8 +1186,8 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
self.topdir + "/logs/x86_64/buildinstall-Server-RPMs.x86_64.log"
|
self.topdir + "/logs/x86_64/buildinstall-Server-RPMs.x86_64.log"
|
||||||
) as f:
|
) as f:
|
||||||
rpms = f.read().strip().split("\n")
|
rpms = f.read().strip().split("\n")
|
||||||
six.assertCountEqual(self, rpms, ["bash", "zsh"])
|
self.assertCountEqual(rpms, ["bash", "zsh"])
|
||||||
six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")])
|
self.assertCountEqual(self.pool.finished_tasks, [("Server", "x86_64")])
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
mock_tweak.call_args_list,
|
mock_tweak.call_args_list,
|
||||||
@ -1297,8 +1281,8 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
self.topdir + "/logs/x86_64/buildinstall-Server-RPMs.x86_64.log"
|
self.topdir + "/logs/x86_64/buildinstall-Server-RPMs.x86_64.log"
|
||||||
) as f:
|
) as f:
|
||||||
rpms = f.read().strip().split("\n")
|
rpms = f.read().strip().split("\n")
|
||||||
six.assertCountEqual(self, rpms, ["bash", "zsh"])
|
self.assertCountEqual(rpms, ["bash", "zsh"])
|
||||||
six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")])
|
self.assertCountEqual(self.pool.finished_tasks, [("Server", "x86_64")])
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
mock_tweak.call_args_list,
|
mock_tweak.call_args_list,
|
||||||
@ -1378,7 +1362,6 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(self.pool.finished_tasks, set())
|
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.KojiWrapper")
|
||||||
@mock.patch("pungi.wrappers.kojiwrapper.get_buildroot_rpms")
|
@mock.patch("pungi.wrappers.kojiwrapper.get_buildroot_rpms")
|
||||||
@mock.patch("pungi.phases.buildinstall.run")
|
@mock.patch("pungi.phases.buildinstall.run")
|
||||||
@ -1565,14 +1548,13 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||||||
self.topdir + "/logs/x86_64/buildinstall-Server-RPMs.x86_64.log"
|
self.topdir + "/logs/x86_64/buildinstall-Server-RPMs.x86_64.log"
|
||||||
) as f:
|
) as f:
|
||||||
rpms = f.read().strip().split("\n")
|
rpms = f.read().strip().split("\n")
|
||||||
six.assertCountEqual(self, rpms, ["bash", "zsh"])
|
self.assertCountEqual(rpms, ["bash", "zsh"])
|
||||||
six.assertCountEqual(self, self.pool.finished_tasks, [("Server", "x86_64")])
|
self.assertCountEqual(self.pool.finished_tasks, [("Server", "x86_64")])
|
||||||
|
|
||||||
buildinstall_topdir = os.path.join(
|
buildinstall_topdir = os.path.join(
|
||||||
"/buildinstall_topdir", "buildinstall-" + os.path.basename(self.topdir)
|
"/buildinstall_topdir", "buildinstall-" + os.path.basename(self.topdir)
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
copy_all.mock_calls,
|
copy_all.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
|
@ -4,7 +4,7 @@ from unittest import mock
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import os
|
import os
|
||||||
from six import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
import kobo.conf
|
import kobo.conf
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ from unittest import mock
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import six
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@ -394,22 +393,17 @@ class ComposeTestCase(unittest.TestCase):
|
|||||||
sorted(v.uid for v in compose.variants["Server"].variants.values()),
|
sorted(v.uid for v in compose.variants["Server"].variants.values()),
|
||||||
["Server-Gluster", "Server-ResilientStorage", "Server-optional"],
|
["Server-Gluster", "Server-ResilientStorage", "Server-optional"],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(compose.variants["Client"].arches, ["i386", "x86_64"])
|
||||||
self, compose.variants["Client"].arches, ["i386", "x86_64"]
|
|
||||||
)
|
|
||||||
self.assertEqual(compose.variants["Crashy"].arches, ["ppc64le"])
|
self.assertEqual(compose.variants["Crashy"].arches, ["ppc64le"])
|
||||||
self.assertEqual(compose.variants["Live"].arches, ["x86_64"])
|
self.assertEqual(compose.variants["Live"].arches, ["x86_64"])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(compose.variants["Server"].arches, ["s390x", "x86_64"])
|
||||||
self, compose.variants["Server"].arches, ["s390x", "x86_64"]
|
|
||||||
)
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
compose.variants["Server"].variants["Gluster"].arches, ["x86_64"]
|
compose.variants["Server"].variants["Gluster"].arches, ["x86_64"]
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
compose.variants["Server"].variants["ResilientStorage"].arches, ["x86_64"]
|
compose.variants["Server"].variants["ResilientStorage"].arches, ["x86_64"]
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
compose.variants["Server"].variants["optional"].arches,
|
compose.variants["Server"].variants["optional"].arches,
|
||||||
["s390x", "x86_64"],
|
["s390x", "x86_64"],
|
||||||
)
|
)
|
||||||
@ -503,12 +497,8 @@ class ComposeTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
sorted(v.uid for v in compose.variants.values()), ["Client", "Server"]
|
sorted(v.uid for v in compose.variants.values()), ["Client", "Server"]
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(compose.variants["Client"].arches, ["i386", "x86_64"])
|
||||||
self, compose.variants["Client"].arches, ["i386", "x86_64"]
|
self.assertCountEqual(compose.variants["Server"].arches, ["s390x", "x86_64"])
|
||||||
)
|
|
||||||
six.assertCountEqual(
|
|
||||||
self, compose.variants["Server"].arches, ["s390x", "x86_64"]
|
|
||||||
)
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
compose.variants["Server"].variants["Gluster"].arches, ["x86_64"]
|
compose.variants["Server"].variants["Gluster"].arches, ["x86_64"]
|
||||||
)
|
)
|
||||||
@ -559,8 +549,7 @@ class ComposeTestCase(unittest.TestCase):
|
|||||||
["Client", "Server", "Server-optional"],
|
["Client", "Server", "Server-optional"],
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
logger.info.call_args_list,
|
logger.info.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call("Excluding variant Live: filtered by configuration."),
|
mock.call("Excluding variant Live: filtered by configuration."),
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import six
|
try:
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
except ImportError:
|
||||||
|
import mock
|
||||||
|
|
||||||
from pungi import checks
|
from pungi import checks
|
||||||
from tests.helpers import load_config, PKGSET_REPOS
|
from tests.helpers import load_config, PKGSET_REPOS
|
||||||
@ -12,7 +14,7 @@ from tests.helpers import load_config, PKGSET_REPOS
|
|||||||
class ConfigTestCase(unittest.TestCase):
|
class ConfigTestCase(unittest.TestCase):
|
||||||
def assertValidation(self, cfg, errors=[], warnings=[]):
|
def assertValidation(self, cfg, errors=[], warnings=[]):
|
||||||
actual_errors, actual_warnings = checks.validate(cfg)
|
actual_errors, actual_warnings = checks.validate(cfg)
|
||||||
six.assertCountEqual(self, errors, actual_errors)
|
self.assertCountEqual(errors, actual_errors)
|
||||||
self.assertEqual(warnings, actual_warnings)
|
self.assertEqual(warnings, actual_warnings)
|
||||||
|
|
||||||
|
|
||||||
@ -263,8 +265,7 @@ class GatherConfigTestCase(ConfigTestCase):
|
|||||||
pkgset_koji_tag="f27",
|
pkgset_koji_tag="f27",
|
||||||
)
|
)
|
||||||
|
|
||||||
with mock.patch("six.PY2", new=False):
|
self.assertValidation(cfg, [])
|
||||||
self.assertValidation(cfg, [])
|
|
||||||
self.assertEqual(cfg["gather_backend"], "dnf")
|
self.assertEqual(cfg["gather_backend"], "dnf")
|
||||||
|
|
||||||
def test_yum_backend_is_rejected_on_py3(self):
|
def test_yum_backend_is_rejected_on_py3(self):
|
||||||
@ -274,11 +275,10 @@ class GatherConfigTestCase(ConfigTestCase):
|
|||||||
gather_backend="yum",
|
gather_backend="yum",
|
||||||
)
|
)
|
||||||
|
|
||||||
with mock.patch("six.PY2", new=False):
|
self.assertValidation(
|
||||||
self.assertValidation(
|
cfg,
|
||||||
cfg,
|
["Failed validation in gather_backend: 'yum' is not one of ['dnf']"],
|
||||||
["Failed validation in gather_backend: 'yum' is not one of ['dnf']"],
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class OSBSConfigTestCase(ConfigTestCase):
|
class OSBSConfigTestCase(ConfigTestCase):
|
||||||
@ -437,9 +437,10 @@ class TestRegexValidation(ConfigTestCase):
|
|||||||
def test_incorrect_regular_expression(self):
|
def test_incorrect_regular_expression(self):
|
||||||
cfg = load_config(PKGSET_REPOS, multilib=[("^*$", {"*": []})])
|
cfg = load_config(PKGSET_REPOS, multilib=[("^*$", {"*": []})])
|
||||||
|
|
||||||
msg = "Failed validation in multilib.0.0: incorrect regular expression: nothing to repeat" # noqa: E501
|
msg = (
|
||||||
if six.PY3:
|
"Failed validation in multilib.0.0: incorrect regular expression: "
|
||||||
msg += " at position 1"
|
"nothing to repeat at position 1"
|
||||||
|
)
|
||||||
self.assertValidation(cfg, [msg], [])
|
self.assertValidation(cfg, [msg], [])
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
try:
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
except ImportError:
|
||||||
|
import mock
|
||||||
|
import io
|
||||||
import os
|
import os
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.scripts.config_validate import cli_main
|
from pungi.scripts.config_validate import cli_main
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
@ -16,8 +18,8 @@ SCHEMA_OVERRIDE = os.path.join(HERE, "data/dummy-override.json")
|
|||||||
|
|
||||||
class ConfigValidateScriptTest(helpers.PungiTestCase):
|
class ConfigValidateScriptTest(helpers.PungiTestCase):
|
||||||
@mock.patch("sys.argv", new=["pungi-config-validate", DUMMY_CONFIG])
|
@mock.patch("sys.argv", new=["pungi-config-validate", DUMMY_CONFIG])
|
||||||
@mock.patch("sys.stderr", new_callable=six.StringIO)
|
@mock.patch("sys.stderr", new_callable=io.StringIO)
|
||||||
@mock.patch("sys.stdout", new_callable=six.StringIO)
|
@mock.patch("sys.stdout", new_callable=io.StringIO)
|
||||||
def test_validate_dummy_config(self, stdout, stderr):
|
def test_validate_dummy_config(self, stdout, stderr):
|
||||||
cli_main()
|
cli_main()
|
||||||
self.assertEqual("", stdout.getvalue())
|
self.assertEqual("", stdout.getvalue())
|
||||||
@ -32,8 +34,8 @@ class ConfigValidateScriptTest(helpers.PungiTestCase):
|
|||||||
SCHEMA_OVERRIDE,
|
SCHEMA_OVERRIDE,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@mock.patch("sys.stderr", new_callable=six.StringIO)
|
@mock.patch("sys.stderr", new_callable=io.StringIO)
|
||||||
@mock.patch("sys.stdout", new_callable=six.StringIO)
|
@mock.patch("sys.stdout", new_callable=io.StringIO)
|
||||||
@mock.patch("sys.exit")
|
@mock.patch("sys.exit")
|
||||||
def test_schema_override(self, exit, stdout, stderr):
|
def test_schema_override(self, exit, stdout, stderr):
|
||||||
cli_main()
|
cli_main()
|
||||||
|
@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from unittest import mock
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import six
|
|
||||||
|
try:
|
||||||
|
from unittest import mock
|
||||||
|
except ImportError:
|
||||||
|
import mock
|
||||||
|
|
||||||
import productmd
|
import productmd
|
||||||
import os
|
import os
|
||||||
@ -45,8 +48,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(len(pool.add.call_args_list), 0)
|
self.assertEqual(len(pool.add.call_args_list), 0)
|
||||||
self.assertEqual(pool.queue_put.call_args_list, [])
|
self.assertEqual(pool.queue_put.call_args_list, [])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
phase.logger.warning.call_args_list,
|
phase.logger.warning.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call("No RPMs found for Everything.x86_64, skipping ISO"),
|
mock.call("No RPMs found for Everything.x86_64, skipping ISO"),
|
||||||
@ -193,8 +195,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.logger = mock.Mock()
|
phase.logger = mock.Mock()
|
||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
prepare_iso.call_args_list,
|
prepare_iso.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -215,8 +216,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
split_iso.call_args_list,
|
split_iso.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -237,8 +237,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(len(pool.add.call_args_list), 2)
|
self.assertEqual(len(pool.add.call_args_list), 2)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
[x[0][0] for x in write_script.call_args_list],
|
[x[0][0] for x in write_script.call_args_list],
|
||||||
[
|
[
|
||||||
CreateIsoOpts(
|
CreateIsoOpts(
|
||||||
@ -273,8 +272,7 @@ class CreateisoPhaseTest(helpers.PungiTestCase):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
pool.queue_put.call_args_list,
|
pool.queue_put.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
|
@ -4,7 +4,7 @@ from unittest import mock
|
|||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from six.moves import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
from pungi import createiso
|
from pungi import createiso
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.wrappers.createrepo import CreaterepoWrapper
|
from pungi.wrappers.createrepo import CreaterepoWrapper
|
||||||
|
|
||||||
|
|
||||||
@ -13,8 +11,8 @@ class CreateRepoWrapperTest(unittest.TestCase):
|
|||||||
cmd = repo.get_createrepo_cmd("/test/dir")
|
cmd = repo.get_createrepo_cmd("/test/dir")
|
||||||
|
|
||||||
self.assertEqual(cmd[:2], ["createrepo_c", "/test/dir"])
|
self.assertEqual(cmd[:2], ["createrepo_c", "/test/dir"])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self, cmd[2:], ["--update", "--database", "--unique-md-filenames"]
|
cmd[2:], ["--update", "--database", "--unique-md-filenames"]
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_get_createrepo_c_cmd_full(self):
|
def test_get_createrepo_c_cmd_full(self):
|
||||||
@ -50,8 +48,7 @@ class CreateRepoWrapperTest(unittest.TestCase):
|
|||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
self.assertEqual(cmd[:2], ["createrepo_c", "/test/dir"])
|
self.assertEqual(cmd[:2], ["createrepo_c", "/test/dir"])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[2:],
|
cmd[2:],
|
||||||
[
|
[
|
||||||
"--baseurl=http://base.example.com",
|
"--baseurl=http://base.example.com",
|
||||||
@ -89,8 +86,7 @@ class CreateRepoWrapperTest(unittest.TestCase):
|
|||||||
cmd = repo.get_createrepo_cmd("/test/dir")
|
cmd = repo.get_createrepo_cmd("/test/dir")
|
||||||
|
|
||||||
self.assertEqual(cmd[:2], ["createrepo", "/test/dir"])
|
self.assertEqual(cmd[:2], ["createrepo", "/test/dir"])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[2:],
|
cmd[2:],
|
||||||
["--update", "--database", "--unique-md-filenames", "--pretty"],
|
["--update", "--database", "--unique-md-filenames", "--pretty"],
|
||||||
)
|
)
|
||||||
@ -126,8 +122,7 @@ class CreateRepoWrapperTest(unittest.TestCase):
|
|||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
self.assertEqual(cmd[:2], ["createrepo", "/test/dir"])
|
self.assertEqual(cmd[:2], ["createrepo", "/test/dir"])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[2:],
|
cmd[2:],
|
||||||
[
|
[
|
||||||
"--baseurl=http://base.example.com",
|
"--baseurl=http://base.example.com",
|
||||||
|
@ -4,8 +4,10 @@ import glob
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from unittest import mock
|
try:
|
||||||
import six
|
from unittest import mock
|
||||||
|
except ImportError:
|
||||||
|
import mock
|
||||||
|
|
||||||
from pungi.module_util import Modulemd
|
from pungi.module_util import Modulemd
|
||||||
from pungi.phases.createrepo import (
|
from pungi.phases.createrepo import (
|
||||||
@ -71,8 +73,7 @@ class TestCreaterepoPhase(PungiTestCase):
|
|||||||
everything = compose.variants["Everything"]
|
everything = compose.variants["Everything"]
|
||||||
client = compose.variants["Client"]
|
client = compose.variants["Client"]
|
||||||
self.assertEqual(len(pool.add.mock_calls), 5)
|
self.assertEqual(len(pool.add.mock_calls), 5)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
pool.queue_put.mock_calls,
|
pool.queue_put.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call((compose, "x86_64", server, "rpm")),
|
mock.call((compose, "x86_64", server, "rpm")),
|
||||||
@ -107,8 +108,7 @@ class TestCreaterepoPhase(PungiTestCase):
|
|||||||
server = compose.variants["Server"]
|
server = compose.variants["Server"]
|
||||||
everything = compose.variants["Everything"]
|
everything = compose.variants["Everything"]
|
||||||
self.assertEqual(len(pool.add.mock_calls), 5)
|
self.assertEqual(len(pool.add.mock_calls), 5)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
pool.queue_put.mock_calls,
|
pool.queue_put.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call((compose, "x86_64", server, "rpm")),
|
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))
|
tc.assertEqual(len(module_streams), len(module_artifacts))
|
||||||
for ms in module_streams:
|
for ms in module_streams:
|
||||||
tc.assertIn(ms.get_stream_name(), module_artifacts)
|
tc.assertIn(ms.get_stream_name(), module_artifacts)
|
||||||
six.assertCountEqual(
|
tc.assertCountEqual(
|
||||||
tc,
|
|
||||||
ms.get_rpm_artifacts(),
|
ms.get_rpm_artifacts(),
|
||||||
module_artifacts[ms.get_stream_name()],
|
module_artifacts[ms.get_stream_name()],
|
||||||
)
|
)
|
||||||
@ -1356,7 +1355,7 @@ class TestGetProductIds(PungiTestCase):
|
|||||||
"productid",
|
"productid",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
six.assertCountEqual(self, pids, expected)
|
self.assertCountEqual(pids, expected)
|
||||||
|
|
||||||
@mock.patch("pungi.phases.createrepo.get_dir_from_scm")
|
@mock.patch("pungi.phases.createrepo.get_dir_from_scm")
|
||||||
def test_not_configured(self, get_dir_from_scm):
|
def test_not_configured(self, get_dir_from_scm):
|
||||||
|
@ -5,8 +5,6 @@ import os
|
|||||||
|
|
||||||
from productmd.extra_files import ExtraFiles
|
from productmd.extra_files import ExtraFiles
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.phases import extra_files
|
from pungi.phases import extra_files
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
|
|
||||||
@ -31,8 +29,7 @@ class TestExtraFilePhase(helpers.PungiTestCase):
|
|||||||
phase = extra_files.ExtraFilesPhase(compose, pkgset_phase)
|
phase = extra_files.ExtraFilesPhase(compose, pkgset_phase)
|
||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
copy_extra_files.call_args_list,
|
copy_extra_files.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from typing import AnyStr, List
|
|
||||||
from unittest import mock
|
|
||||||
import six
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
try:
|
||||||
|
from unittest import mock
|
||||||
|
except ImportError:
|
||||||
|
import mock
|
||||||
|
from typing import AnyStr, List
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
@ -35,8 +39,7 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 3)
|
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 3)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
ThreadPool.return_value.queue_put.call_args_list,
|
ThreadPool.return_value.queue_put.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call((compose, cfg, compose.variants["Server"], "x86_64")),
|
mock.call((compose, cfg, compose.variants["Server"], "x86_64")),
|
||||||
@ -56,8 +59,7 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2)
|
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
ThreadPool.return_value.queue_put.call_args_list,
|
ThreadPool.return_value.queue_put.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call((compose, cfg, compose.variants["Server"], "x86_64")),
|
mock.call((compose, cfg, compose.variants["Server"], "x86_64")),
|
||||||
@ -76,8 +78,7 @@ class ExtraIsosPhaseTest(helpers.PungiTestCase):
|
|||||||
phase.run()
|
phase.run()
|
||||||
|
|
||||||
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2)
|
self.assertEqual(len(ThreadPool.return_value.add.call_args_list), 2)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
ThreadPool.return_value.queue_put.call_args_list,
|
ThreadPool.return_value.queue_put.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call((compose, cfg, compose.variants["Server"], "x86_64")),
|
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",
|
"Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml",
|
||||||
}
|
}
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
ggp.call_args_list,
|
ggp.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -753,8 +753,7 @@ class GetIsoContentsTest(helpers.PungiTestCase):
|
|||||||
"Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml",
|
"Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml",
|
||||||
}
|
}
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
ggp.call_args_list,
|
ggp.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -831,8 +830,7 @@ class GetIsoContentsTest(helpers.PungiTestCase):
|
|||||||
"Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml",
|
"Server/repodata/repomd.xml": "/mnt/repodata/repomd.xml",
|
||||||
}
|
}
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
ggp.call_args_list,
|
ggp.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -934,8 +932,7 @@ class GetIsoContentsTest(helpers.PungiTestCase):
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
ggp.call_args_list,
|
ggp.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
|
@ -4,8 +4,6 @@ import unittest
|
|||||||
import tempfile
|
import tempfile
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from pungi.wrappers import fus
|
from pungi.wrappers import fus
|
||||||
@ -133,8 +131,7 @@ class TestParseOutput(unittest.TestCase):
|
|||||||
def test_separates_arch(self):
|
def test_separates_arch(self):
|
||||||
touch(self.file, "pkg-1.0-1.x86_64@repo-0\npkg-1.0-1.i686@repo-0\n")
|
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)
|
packages, modules = fus.parse_output(self.file)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
packages,
|
packages,
|
||||||
[("pkg-1.0-1", "x86_64", frozenset()), ("pkg-1.0-1", "i686", frozenset())],
|
[("pkg-1.0-1", "x86_64", frozenset()), ("pkg-1.0-1", "i686", frozenset())],
|
||||||
)
|
)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,8 +5,6 @@ import copy
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.phases.gather.methods import method_hybrid as hybrid
|
from pungi.phases.gather.methods import method_hybrid as hybrid
|
||||||
from pungi.phases.pkgset.common import MaterializedPackageSet as PkgSet
|
from pungi.phases.pkgset.common import MaterializedPackageSet as PkgSet
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
@ -210,7 +208,7 @@ class TestMethodHybrid(helpers.PungiTestCase):
|
|||||||
]
|
]
|
||||||
expanded = m.expand_list(["foo*"])
|
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):
|
class MockModule(object):
|
||||||
@ -445,7 +443,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
cache_dir="/cache",
|
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(res[1], set())
|
||||||
self.assertEqual(po.call_args_list, [mock.call(self.logfile1)])
|
self.assertEqual(po.call_args_list, [mock.call(self.logfile1)])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -512,8 +510,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
cache_dir="/cache",
|
cache_dir="/cache",
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
res[0],
|
res[0],
|
||||||
[
|
[
|
||||||
("pkg-1.0-1", "x86_64", frozenset()),
|
("pkg-1.0-1", "x86_64", frozenset()),
|
||||||
@ -585,7 +582,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
cache_dir="/cache",
|
cache_dir="/cache",
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(self, res[0], final)
|
self.assertCountEqual(res[0], final)
|
||||||
self.assertEqual(res[1], set())
|
self.assertEqual(res[1], set())
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
po.call_args_list, [mock.call(self.logfile1), mock.call(self.logfile2)]
|
||||||
@ -675,8 +672,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
cache_dir="/cache",
|
cache_dir="/cache",
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
res[0],
|
res[0],
|
||||||
[
|
[
|
||||||
("pkg-devel-1.0-1", "x86_64", frozenset()),
|
("pkg-devel-1.0-1", "x86_64", frozenset()),
|
||||||
@ -796,8 +792,7 @@ class TestRunSolver(HelperMixin, helpers.PungiTestCase):
|
|||||||
cache_dir="/cache",
|
cache_dir="/cache",
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
res[0],
|
res[0],
|
||||||
[
|
[
|
||||||
("pkg-devel-1.0-1", "x86_64", frozenset()),
|
("pkg-devel-1.0-1", "x86_64", frozenset()),
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.phases.gather.methods import method_nodeps as nodeps
|
from pungi.phases.gather.methods import method_nodeps as nodeps
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
|
|
||||||
@ -21,8 +19,7 @@ class TestWritePungiConfig(helpers.PungiTestCase):
|
|||||||
packages = nodeps.expand_groups(
|
packages = nodeps.expand_groups(
|
||||||
self.compose, "x86_64", None, ["core", "text-internet"]
|
self.compose, "x86_64", None, ["core", "text-internet"]
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
packages,
|
packages,
|
||||||
[
|
[
|
||||||
("dummy-bash", "x86_64"),
|
("dummy-bash", "x86_64"),
|
||||||
|
@ -8,8 +8,6 @@ from unittest import mock
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.phases import gather
|
from pungi.phases import gather
|
||||||
from pungi.phases.gather import _mk_pkg_map
|
from pungi.phases.gather import _mk_pkg_map
|
||||||
from pungi.phases.pkgset.common import MaterializedPackageSet
|
from pungi.phases.pkgset.common import MaterializedPackageSet
|
||||||
@ -137,8 +135,7 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -191,8 +188,7 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -252,8 +248,7 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -340,8 +335,7 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -420,8 +414,7 @@ class TestGatherWrapper(helpers.PungiTestCase):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
write_packages.call_args_list,
|
write_packages.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -565,8 +558,7 @@ class TestGetSystemRelease(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(packages, set([("system-release-server", None)]))
|
self.assertEqual(packages, set([("system-release-server", None)]))
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
filter_packages,
|
filter_packages,
|
||||||
set([("system-release-client", None), ("system-release", None)]),
|
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"
|
self.topdir, "work", "x86_64", "package_list", "Server.x86_64.rpm.conf"
|
||||||
)
|
)
|
||||||
) as f:
|
) as f:
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
f.read().strip().split("\n"),
|
f.read().strip().split("\n"),
|
||||||
[
|
[
|
||||||
"/build/foo-1.0-1.x86_64.rpm",
|
"/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"
|
self.topdir, "work", "x86_64", "package_list", "Server.x86_64.srpm.conf"
|
||||||
)
|
)
|
||||||
) as f:
|
) as f:
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
f.read().strip().split("\n"),
|
f.read().strip().split("\n"),
|
||||||
["/build/foo-1.0-1.src.rpm", "/build/bar-1.0-1.src.rpm"],
|
["/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(
|
packages, groups, filter_packages = gather.get_variant_packages(
|
||||||
compose, "x86_64", compose.all_variants["Server-optional"], "comps"
|
compose, "x86_64", compose.all_variants["Server-optional"], "comps"
|
||||||
)
|
)
|
||||||
six.assertCountEqual(self, packages, ["server-pkg", "addon-pkg", "opt-pkg"])
|
self.assertCountEqual(packages, ["server-pkg", "addon-pkg", "opt-pkg"])
|
||||||
six.assertCountEqual(self, groups, ["server-group", "addon-group", "opt-group"])
|
self.assertCountEqual(groups, ["server-group", "addon-group", "opt-group"])
|
||||||
self.assertEqual(filter_packages, set())
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
@mock.patch("pungi.phases.gather.get_gather_source")
|
@mock.patch("pungi.phases.gather.get_gather_source")
|
||||||
@ -847,7 +837,7 @@ class TestGetVariantPackages(helpers.PungiTestCase):
|
|||||||
packages, groups, filter_packages = gather.get_variant_packages(
|
packages, groups, filter_packages = gather.get_variant_packages(
|
||||||
compose, "x86_64", compose.all_variants["Server"], "comps"
|
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(groups, set())
|
||||||
self.assertEqual(filter_packages, set())
|
self.assertEqual(filter_packages, set())
|
||||||
|
|
||||||
@ -1422,8 +1412,7 @@ class TestGetPrepopulate(helpers.PungiTestCase):
|
|||||||
"prepopulate.json",
|
"prepopulate.json",
|
||||||
os.path.join(self.topdir, "work", "global", "prepopulate.json"),
|
os.path.join(self.topdir, "work", "global", "prepopulate.json"),
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
gather.get_prepopulate_packages(
|
gather.get_prepopulate_packages(
|
||||||
self.compose, "x86_64", self.compose.variants["Server"]
|
self.compose, "x86_64", self.compose.variants["Server"]
|
||||||
),
|
),
|
||||||
@ -1435,8 +1424,7 @@ class TestGetPrepopulate(helpers.PungiTestCase):
|
|||||||
"prepopulate.json",
|
"prepopulate.json",
|
||||||
os.path.join(self.topdir, "work", "global", "prepopulate.json"),
|
os.path.join(self.topdir, "work", "global", "prepopulate.json"),
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
gather.get_prepopulate_packages(self.compose, "x86_64", None),
|
gather.get_prepopulate_packages(self.compose, "x86_64", None),
|
||||||
["foo-common.noarch", "foo.i686", "foo.x86_64", "bar.x86_64"],
|
["foo-common.noarch", "foo.i686", "foo.x86_64", "bar.x86_64"],
|
||||||
)
|
)
|
||||||
@ -1446,8 +1434,7 @@ class TestGetPrepopulate(helpers.PungiTestCase):
|
|||||||
"prepopulate.json",
|
"prepopulate.json",
|
||||||
os.path.join(self.topdir, "work", "global", "prepopulate.json"),
|
os.path.join(self.topdir, "work", "global", "prepopulate.json"),
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
gather.get_prepopulate_packages(
|
gather.get_prepopulate_packages(
|
||||||
self.compose, "x86_64", None, include_arch=False
|
self.compose, "x86_64", None, include_arch=False
|
||||||
),
|
),
|
||||||
@ -1483,8 +1470,7 @@ class TestGatherPhase(helpers.PungiTestCase):
|
|||||||
gather_wrapper.call_args_list,
|
gather_wrapper.call_args_list,
|
||||||
[mock.call(compose, pkgset_phase.package_sets, pkgset_phase.path_prefix)],
|
[mock.call(compose, pkgset_phase.package_sets, pkgset_phase.path_prefix)],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
link_files.call_args_list,
|
link_files.call_args_list,
|
||||||
[
|
[
|
||||||
_mk_link_call("x86_64", "Server"),
|
_mk_link_call("x86_64", "Server"),
|
||||||
@ -1582,7 +1568,7 @@ class TestGetPackagesToGather(helpers.PungiTestCase):
|
|||||||
|
|
||||||
packages, groups = gather.get_packages_to_gather(self.compose)
|
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"])
|
self.assertEqual(groups, ["core"])
|
||||||
|
|
||||||
@mock.patch("pungi.phases.gather.get_gather_source")
|
@mock.patch("pungi.phases.gather.get_gather_source")
|
||||||
@ -1595,7 +1581,7 @@ class TestGetPackagesToGather(helpers.PungiTestCase):
|
|||||||
self.compose, include_arch=False
|
self.compose, include_arch=False
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(self, packages, ["foo", "foo2", "pkg"])
|
self.assertCountEqual(packages, ["foo", "foo2", "pkg"])
|
||||||
self.assertEqual(groups, ["core"])
|
self.assertEqual(groups, ["core"])
|
||||||
|
|
||||||
@mock.patch("pungi.phases.gather.get_gather_source")
|
@mock.patch("pungi.phases.gather.get_gather_source")
|
||||||
@ -1608,8 +1594,7 @@ class TestGetPackagesToGather(helpers.PungiTestCase):
|
|||||||
self.compose, include_prepopulated=True
|
self.compose, include_prepopulated=True
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
packages,
|
packages,
|
||||||
[
|
[
|
||||||
"foo",
|
"foo",
|
||||||
@ -1633,9 +1618,7 @@ class TestGetPackagesToGather(helpers.PungiTestCase):
|
|||||||
self.compose, include_prepopulated=True, include_arch=False
|
self.compose, include_prepopulated=True, include_arch=False
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(packages, ["foo", "pkg", "foo-common", "foo2", "bar"])
|
||||||
self, packages, ["foo", "pkg", "foo-common", "foo2", "bar"]
|
|
||||||
)
|
|
||||||
self.assertEqual(groups, ["core"])
|
self.assertEqual(groups, ["core"])
|
||||||
|
|
||||||
@mock.patch("pungi.phases.gather.get_gather_source")
|
@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")
|
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"])
|
self.assertEqual(groups, ["core"])
|
||||||
|
|
||||||
|
|
||||||
@ -1765,8 +1748,7 @@ class TestMakeLookasideRepo(helpers.PungiTestCase):
|
|||||||
def assertCorrect(self, repopath, path_prefix, MockCR, mock_run):
|
def assertCorrect(self, repopath, path_prefix, MockCR, mock_run):
|
||||||
with open(self.pkglist) as f:
|
with open(self.pkglist) as f:
|
||||||
packages = f.read().splitlines()
|
packages = f.read().splitlines()
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
packages,
|
packages,
|
||||||
[
|
[
|
||||||
"pkg/pkg-1.0-1.x86_64.rpm",
|
"pkg/pkg-1.0-1.x86_64.rpm",
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from unittest import mock
|
try:
|
||||||
import six
|
from unittest import mock
|
||||||
|
except ImportError:
|
||||||
|
import mock
|
||||||
|
|
||||||
from pungi.phases.gather.sources.source_module import GatherSourceModule
|
from pungi.phases.gather.sources.source_module import GatherSourceModule
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
@ -51,8 +53,7 @@ class TestGatherSourceModule(helpers.PungiTestCase):
|
|||||||
|
|
||||||
source = GatherSourceModule(self.compose)
|
source = GatherSourceModule(self.compose)
|
||||||
packages, groups = source("x86_64", self.compose.variants["Server"])
|
packages, groups = source("x86_64", self.compose.variants["Server"])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
[(rpm[0].nevra, rpm[1]) for rpm in packages],
|
[(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)],
|
[("pkg-0:1.0.0-1.x86_64", None), ("pkg-0:1.0.0-1.i686", None)],
|
||||||
)
|
)
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from pungi.phases.image_build import ImageBuildPhase, CreateImageBuildThread
|
from pungi.phases.image_build import ImageBuildPhase, CreateImageBuildThread
|
||||||
@ -99,8 +97,7 @@ class TestImageBuildPhase(PungiTestCase):
|
|||||||
"link_type": "hardlink-or-copy",
|
"link_type": "hardlink-or-copy",
|
||||||
"scratch": False,
|
"scratch": False,
|
||||||
}
|
}
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
phase.pool.queue_put.mock_calls,
|
phase.pool.queue_put.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call((compose, client_args, phase.buildinstall_phase)),
|
mock.call((compose, client_args, phase.buildinstall_phase)),
|
||||||
@ -882,8 +879,7 @@ class TestCreateImageBuildThread(PungiTestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
linker.mock_calls,
|
linker.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call.link(
|
mock.call.link(
|
||||||
|
@ -8,8 +8,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from pungi.module_util import Modulemd
|
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_global.mock_calls, [mock.call(compose)])
|
||||||
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
write_arch.mock_calls,
|
write_arch.mock_calls,
|
||||||
[mock.call(compose, "x86_64"), mock.call(compose, "amd64")],
|
[mock.call(compose, "x86_64"), mock.call(compose, "amd64")],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
create_comps.mock_calls,
|
create_comps.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(compose, "x86_64", None),
|
mock.call(compose, "x86_64", None),
|
||||||
@ -75,8 +71,7 @@ class TestInitPhase(PungiTestCase):
|
|||||||
mock.call(compose, "x86_64", compose.all_variants["Server-optional"]),
|
mock.call(compose, "x86_64", compose.all_variants["Server-optional"]),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
write_variant.mock_calls,
|
write_variant.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(compose, "x86_64", compose.variants["Server"]),
|
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)]
|
validate_comps.call_args_list, [mock.call(write_global.return_value)]
|
||||||
)
|
)
|
||||||
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
self.assertEqual(write_prepopulate.mock_calls, [mock.call(compose)])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
write_arch.mock_calls,
|
write_arch.mock_calls,
|
||||||
[mock.call(compose, "x86_64"), mock.call(compose, "amd64")],
|
[mock.call(compose, "x86_64"), mock.call(compose, "amd64")],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
create_comps.mock_calls,
|
create_comps.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(compose, "x86_64", None),
|
mock.call(compose, "x86_64", None),
|
||||||
@ -135,8 +128,7 @@ class TestInitPhase(PungiTestCase):
|
|||||||
mock.call(compose, "amd64", compose.variants["Everything"]),
|
mock.call(compose, "amd64", compose.variants["Everything"]),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
write_variant.mock_calls,
|
write_variant.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(compose, "x86_64", compose.variants["Server"]),
|
mock.call(compose, "x86_64", compose.variants["Server"]),
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
import itertools
|
import itertools
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
import os
|
import os
|
||||||
import six
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from pungi.wrappers import iso
|
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
|
# The point of this is to avoid issues on Python 2, where apparently
|
||||||
# isdir() is using listdir(), so the mocking is breaking it.
|
# isdir() is using listdir(), so the mocking is breaking it.
|
||||||
def worker(path):
|
def worker(path):
|
||||||
if isinstance(path, six.string_types) and pattern in path:
|
if isinstance(path, str) and pattern in path:
|
||||||
if exc:
|
if exc:
|
||||||
raise exc
|
raise exc
|
||||||
return result
|
return result
|
||||||
|
@ -9,8 +9,6 @@ import tempfile
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.wrappers.kojiwrapper import KojiWrapper, get_buildroot_rpms
|
from pungi.wrappers.kojiwrapper import KojiWrapper, get_buildroot_rpms
|
||||||
|
|
||||||
from .helpers import FIXTURE_DIR
|
from .helpers import FIXTURE_DIR
|
||||||
@ -94,13 +92,12 @@ class KojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(cmd[:3], ["koji", "--profile=custom-koji", "image-build"])
|
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:
|
with open(self.tmpfile, "r") as f:
|
||||||
lines = f.read().strip().split("\n")
|
lines = f.read().strip().split("\n")
|
||||||
self.assertEqual(lines[0], "[image-build]")
|
self.assertEqual(lines[0], "[image-build]")
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
lines[1:],
|
lines[1:],
|
||||||
[
|
[
|
||||||
"name = test-name",
|
"name = test-name",
|
||||||
@ -287,10 +284,9 @@ class KojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
result = self.koji.get_image_paths(12387273)
|
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
|
self.maxDiff = None
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
result["i386"],
|
result["i386"],
|
||||||
[
|
[
|
||||||
"/koji/task/12387276/tdl-i386.xml",
|
"/koji/task/12387276/tdl-i386.xml",
|
||||||
@ -302,8 +298,7 @@ class KojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
"/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.raw.xz",
|
"/koji/task/12387276/Fedora-Cloud-Base-23-20160103.i386.raw.xz",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
result["x86_64"],
|
result["x86_64"],
|
||||||
[
|
[
|
||||||
"/koji/task/12387277/tdl-x86_64.xml",
|
"/koji/task/12387277/tdl-x86_64.xml",
|
||||||
@ -340,8 +335,8 @@ class KojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
|
|
||||||
result = self.koji.get_image_paths(25643870, callback=failed_callback)
|
result = self.koji.get_image_paths(25643870, callback=failed_callback)
|
||||||
|
|
||||||
six.assertCountEqual(self, result.keys(), ["aarch64", "armhfp", "x86_64"])
|
self.assertCountEqual(result.keys(), ["aarch64", "armhfp", "x86_64"])
|
||||||
six.assertCountEqual(self, failed, ["ppc64le", "s390x"])
|
self.assertCountEqual(failed, ["ppc64le", "s390x"])
|
||||||
|
|
||||||
def test_multicall_map(self):
|
def test_multicall_map(self):
|
||||||
self.koji.koji_proxy = mock.Mock()
|
self.koji.koji_proxy = mock.Mock()
|
||||||
@ -354,8 +349,7 @@ class KojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
[{"x": 1}, {"x": 2}],
|
[{"x": 1}, {"x": 2}],
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
self.koji.koji_proxy.getBuild.mock_calls,
|
self.koji.koji_proxy.getBuild.mock_calls,
|
||||||
[mock.call("foo", x=1), mock.call("bar", x=2)],
|
[mock.call("foo", x=1), mock.call("bar", x=2)],
|
||||||
)
|
)
|
||||||
@ -419,8 +413,7 @@ class LiveMediaTestCase(KojiWrapperBaseTestCase):
|
|||||||
"--install-tree=/mnt/os",
|
"--install-tree=/mnt/os",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[9:],
|
cmd[9:],
|
||||||
[
|
[
|
||||||
"--repo=repo-1",
|
"--repo=repo-1",
|
||||||
@ -448,7 +441,7 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
cmd[-1], "rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; date"
|
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):
|
def test_get_cmd_full(self):
|
||||||
cmd = self.koji.get_runroot_cmd(
|
cmd = self.koji.get_runroot_cmd(
|
||||||
@ -469,8 +462,7 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
cmd[-1],
|
cmd[-1],
|
||||||
"rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo '&'",
|
"rm -f /var/lib/rpm/__db*; rm -rf /var/cache/yum/*; set -x; /bin/echo '&'",
|
||||||
)
|
)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[4:-3],
|
cmd[4:-3],
|
||||||
[
|
[
|
||||||
"--channel-override=chan",
|
"--channel-override=chan",
|
||||||
@ -505,8 +497,7 @@ class RunrootKojiWrapperTest(KojiWrapperBaseTestCase):
|
|||||||
cmd[-1],
|
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
|
"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.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[4:-3],
|
cmd[4:-3],
|
||||||
[
|
[
|
||||||
"--channel-override=chan",
|
"--channel-override=chan",
|
||||||
@ -641,8 +632,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
result = self.koji.run_blocking_cmd("cmd")
|
result = self.koji.run_blocking_cmd("cmd")
|
||||||
|
|
||||||
self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234})
|
self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234})
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
run.mock_calls,
|
run.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -668,8 +658,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
result = self.koji.run_blocking_cmd("cmd")
|
result = self.koji.run_blocking_cmd("cmd")
|
||||||
|
|
||||||
self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234})
|
self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234})
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
run.mock_calls,
|
run.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -696,8 +685,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
result = self.koji.run_blocking_cmd("cmd", log_file="logfile")
|
result = self.koji.run_blocking_cmd("cmd", log_file="logfile")
|
||||||
|
|
||||||
self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234})
|
self.assertDictEqual(result, {"retcode": 0, "output": output, "task_id": 1234})
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
run.mock_calls,
|
run.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -720,8 +708,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
result = self.koji.run_blocking_cmd("cmd")
|
result = self.koji.run_blocking_cmd("cmd")
|
||||||
|
|
||||||
self.assertDictEqual(result, {"retcode": 1, "output": output, "task_id": 1234})
|
self.assertDictEqual(result, {"retcode": 1, "output": output, "task_id": 1234})
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
run.mock_calls,
|
run.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -744,8 +731,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
|
|||||||
with self.assertRaises(RuntimeError) as ctx:
|
with self.assertRaises(RuntimeError) as ctx:
|
||||||
self.koji.run_blocking_cmd("cmd")
|
self.koji.run_blocking_cmd("cmd")
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
run.mock_calls,
|
run.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -1113,8 +1099,7 @@ class TestGetBuildrootRPMs(unittest.TestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
rpms,
|
rpms,
|
||||||
[
|
[
|
||||||
"python3-kickstart-2.25-2.fc24.noarch",
|
"python3-kickstart-2.25-2.fc24.noarch",
|
||||||
@ -1131,8 +1116,7 @@ class TestGetBuildrootRPMs(unittest.TestCase):
|
|||||||
|
|
||||||
rpms = get_buildroot_rpms(compose, None)
|
rpms = get_buildroot_rpms(compose, None)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
rpms,
|
rpms,
|
||||||
[
|
[
|
||||||
"cjkuni-uming-fonts-0.2.20080216.1-56.fc23.noarch",
|
"cjkuni-uming-fonts-0.2.20080216.1-56.fc23.noarch",
|
||||||
|
@ -4,8 +4,6 @@ from unittest import mock
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.phases.livemedia_phase import LiveMediaPhase, LiveMediaThread
|
from pungi.phases.livemedia_phase import LiveMediaPhase, LiveMediaThread
|
||||||
from tests.helpers import DummyCompose, PungiTestCase, boom
|
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/x86_64/iso"))
|
||||||
self.assertTrue(os.path.isdir(self.topdir + "/compose/Server/amd64/iso"))
|
self.assertTrue(os.path.isdir(self.topdir + "/compose/Server/amd64/iso"))
|
||||||
link = Linker.return_value.link
|
link = Linker.return_value.link
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
link.mock_calls,
|
link.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.wrappers.lorax import LoraxWrapper
|
from pungi.wrappers.lorax import LoraxWrapper
|
||||||
|
|
||||||
|
|
||||||
@ -17,8 +15,7 @@ class LoraxWrapperTest(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(cmd[0], "lorax")
|
self.assertEqual(cmd[0], "lorax")
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[1:],
|
cmd[1:],
|
||||||
[
|
[
|
||||||
"--product=product",
|
"--product=product",
|
||||||
@ -56,8 +53,7 @@ class LoraxWrapperTest(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(cmd[0], "lorax")
|
self.assertEqual(cmd[0], "lorax")
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[1:],
|
cmd[1:],
|
||||||
[
|
[
|
||||||
"--product=product",
|
"--product=product",
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
|
|
||||||
from pungi import metadata
|
from pungi import metadata
|
||||||
@ -131,8 +129,7 @@ class MediaRepoTestCase(helpers.PungiTestCase):
|
|||||||
with open(self.path) as f:
|
with open(self.path) as f:
|
||||||
lines = f.read().strip().split("\n")
|
lines = f.read().strip().split("\n")
|
||||||
self.assertEqual(lines[0], "[InstallMedia]")
|
self.assertEqual(lines[0], "[InstallMedia]")
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
lines[1:],
|
lines[1:],
|
||||||
[
|
[
|
||||||
"name=Test 1.0",
|
"name=Test 1.0",
|
||||||
@ -190,8 +187,7 @@ class TestPopulateExtraFiles(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
self.metadata.mock_calls,
|
self.metadata.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call.add("Server", "x86_64", "Server/x86_64/os/foo", 3, FOO_MD5),
|
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"]
|
self.metadata, self.variant, "x86_64", self.topdir, ["foo", "bar"], ["md5"]
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
self.metadata.mock_calls,
|
self.metadata.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call.add("Server", "x86_64", "foo", 3, FOO_MD5),
|
mock.call.add("Server", "x86_64", "foo", 3, FOO_MD5),
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import shlex
|
||||||
|
|
||||||
from kobo.shortcuts import force_list
|
from kobo.shortcuts import force_list
|
||||||
|
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
from pungi.phases import ostree_installer as ostree
|
from pungi.phases import ostree_installer as ostree
|
||||||
from six.moves import shlex_quote
|
|
||||||
|
|
||||||
|
|
||||||
LOG_PATH = "logs/x86_64/Everything/ostree_installer-1"
|
LOG_PATH = "logs/x86_64/Everything/ostree_installer-1"
|
||||||
@ -144,7 +144,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
for s in force_list(sources):
|
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("--variant=Everything")
|
||||||
lorax_cmd.append("--nomacboot")
|
lorax_cmd.append("--nomacboot")
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from unittest import mock
|
try:
|
||||||
import six
|
from unittest import mock
|
||||||
|
except ImportError:
|
||||||
|
import mock
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from tests import helpers
|
from tests import helpers
|
||||||
@ -50,8 +52,7 @@ class OstreeTreeScriptTest(helpers.PungiTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def assertCorrectCall(self, mock_run, extra_calls=[], extra_args=[]):
|
def assertCorrectCall(self, mock_run, extra_calls=[], extra_args=[]):
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
mock_run.call_args_list,
|
mock_run.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -393,8 +394,7 @@ class OstreeInstallerScriptTest(helpers.PungiTestCase):
|
|||||||
args.append("--add-arch-template-var=ostree_repo=http://www.example.com/ostree")
|
args.append("--add-arch-template-var=ostree_repo=http://www.example.com/ostree")
|
||||||
ostree.main(args)
|
ostree.main(args)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
run.mock_calls,
|
run.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -457,8 +457,7 @@ class OstreeInstallerScriptTest(helpers.PungiTestCase):
|
|||||||
args.append("--extra-config=%s" % extra_config_file)
|
args.append("--extra-config=%s" % extra_config_file)
|
||||||
ostree.main(args)
|
ostree.main(args)
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
run.mock_calls,
|
run.mock_calls,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from unittest import mock
|
try:
|
||||||
import six
|
from unittest import mock
|
||||||
|
except ImportError:
|
||||||
|
import mock
|
||||||
|
|
||||||
from pungi.module_util import Modulemd
|
from pungi.module_util import Modulemd
|
||||||
from pungi.phases.pkgset import common
|
from pungi.phases.pkgset import common
|
||||||
@ -65,9 +67,7 @@ class TestMaterializedPkgsetCreate(helpers.PungiTestCase):
|
|||||||
self.compose, self.pkgset, self.prefix
|
self.compose, self.pkgset, self.prefix
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(result.package_sets.keys(), ["global", "amd64", "x86_64"])
|
||||||
self, result.package_sets.keys(), ["global", "amd64", "x86_64"]
|
|
||||||
)
|
|
||||||
self.assertEqual(result["global"], self.pkgset)
|
self.assertEqual(result["global"], self.pkgset)
|
||||||
self.assertEqual(result["x86_64"], self.subsets["x86_64"])
|
self.assertEqual(result["x86_64"], self.subsets["x86_64"])
|
||||||
self.assertEqual(result["amd64"], self.subsets["amd64"])
|
self.assertEqual(result["amd64"], self.subsets["amd64"])
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
import ddt
|
import ddt
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
import os
|
import os
|
||||||
import six
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import json
|
import json
|
||||||
@ -127,7 +126,7 @@ class PkgsetCompareMixin(object):
|
|||||||
for k, v1 in expected.items():
|
for k, v1 in expected.items():
|
||||||
self.assertIn(k, actual)
|
self.assertIn(k, actual)
|
||||||
v2 = actual.pop(k)
|
v2 = actual.pop(k)
|
||||||
six.assertCountEqual(self, v1, v2)
|
self.assertCountEqual(v1, v2)
|
||||||
self.assertEqual({}, actual)
|
self.assertEqual({}, actual)
|
||||||
|
|
||||||
|
|
||||||
@ -178,7 +177,7 @@ class TestKojiPkgset(PkgsetCompareMixin, helpers.PungiTestCase):
|
|||||||
for k, v1 in expected.items():
|
for k, v1 in expected.items():
|
||||||
self.assertIn(k, actual)
|
self.assertIn(k, actual)
|
||||||
v2 = actual.pop(k)
|
v2 = actual.pop(k)
|
||||||
six.assertCountEqual(self, v1, v2)
|
self.assertCountEqual(v1, v2)
|
||||||
self.assertEqual({}, actual, msg="Some architectures were missing")
|
self.assertEqual({}, actual, msg="Some architectures were missing")
|
||||||
|
|
||||||
@ddt.data(
|
@ddt.data(
|
||||||
@ -1360,6 +1359,6 @@ class TestSaveFileList(unittest.TestCase):
|
|||||||
|
|
||||||
with open(self.tmpfile) as f:
|
with open(self.tmpfile) as f:
|
||||||
rpms = f.read().strip().split("\n")
|
rpms = f.read().strip().split("\n")
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self, rpms, ["pungi@4.1.3@3.fc25@noarch", "pungi@4.1.3@3.fc25@src"]
|
rpms, ["pungi@4.1.3@3.fc25@noarch", "pungi@4.1.3@3.fc25@src"]
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,6 @@ except ImportError:
|
|||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import six
|
|
||||||
import unittest
|
import unittest
|
||||||
from ddt import ddt, data, unpack
|
from ddt import ddt, data, unpack
|
||||||
from typing import AnyStr, List, Set, Dict, Tuple
|
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)
|
event = source_koji.get_koji_event_info(self.compose, koji_wrapper)
|
||||||
|
|
||||||
self.assertEqual(event, EVENT_INFO)
|
self.assertEqual(event, EVENT_INFO)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self, koji_wrapper.mock_calls, [mock.call.koji_proxy.getEvent(123456)]
|
koji_wrapper.mock_calls, [mock.call.koji_proxy.getEvent(123456)]
|
||||||
)
|
)
|
||||||
with open(self.event_file) as f:
|
with open(self.event_file) as f:
|
||||||
self.assertEqual(json.load(f), EVENT_INFO)
|
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)
|
event = source_koji.get_koji_event_info(self.compose, koji_wrapper)
|
||||||
|
|
||||||
self.assertEqual(event, EVENT_INFO)
|
self.assertEqual(event, EVENT_INFO)
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self, koji_wrapper.mock_calls, [mock.call.koji_proxy.getLastEvent()]
|
koji_wrapper.mock_calls, [mock.call.koji_proxy.getLastEvent()]
|
||||||
)
|
)
|
||||||
with open(self.event_file) as f:
|
with open(self.event_file) as f:
|
||||||
self.assertEqual(json.load(f), EVENT_INFO)
|
self.assertEqual(json.load(f), EVENT_INFO)
|
||||||
@ -150,15 +149,11 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(len(pkgsets), 2)
|
self.assertEqual(len(pkgsets), 2)
|
||||||
init_calls = KojiPackageSet.call_args_list
|
init_calls = KojiPackageSet.call_args_list
|
||||||
six.assertCountEqual(
|
self.assertCountEqual([call[0][0] for call in init_calls], ["f25", "f25-extra"])
|
||||||
self, [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
|
||||||
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][2] for call in init_calls], [["foo", "bar"]] * 2)
|
||||||
|
|
||||||
pkgsets[0].assert_has_calls(
|
pkgsets[0].assert_has_calls(
|
||||||
[
|
[
|
||||||
@ -196,7 +191,7 @@ class TestPopulateGlobalPkgset(helpers.PungiTestCase):
|
|||||||
self.compose, self.koji_wrapper, 123456
|
self.compose, self.koji_wrapper, 123456
|
||||||
)
|
)
|
||||||
self.assertEqual(len(pkgsets), 1)
|
self.assertEqual(len(pkgsets), 1)
|
||||||
six.assertCountEqual(self, pkgsets[0].packages, ["pkg", "foo"])
|
self.assertCountEqual(pkgsets[0].packages, ["pkg", "foo"])
|
||||||
|
|
||||||
|
|
||||||
class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
||||||
@ -214,8 +209,8 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
|||||||
def test_get_package_sets(self, pgp):
|
def test_get_package_sets(self, pgp):
|
||||||
pkgsets = source_koji.get_pkgset_from_koji(self.compose, self.koji_wrapper)
|
pkgsets = source_koji.get_pkgset_from_koji(self.compose, self.koji_wrapper)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self, self.koji_wrapper.koji_proxy.mock_calls, [mock.call.getLastEvent()]
|
self.koji_wrapper.koji_proxy.mock_calls, [mock.call.getLastEvent()]
|
||||||
)
|
)
|
||||||
self.assertEqual(pkgsets, pgp.return_value)
|
self.assertEqual(pkgsets, pgp.return_value)
|
||||||
|
|
||||||
@ -498,12 +493,12 @@ class TestCorrectNVR(helpers.PungiTestCase):
|
|||||||
def test_nv(self):
|
def test_nv(self):
|
||||||
module_info = source_koji.variant_dict_from_str(self.compose, self.nv)
|
module_info = source_koji.variant_dict_from_str(self.compose, self.nv)
|
||||||
expectedKeys = ["stream", "name"]
|
expectedKeys = ["stream", "name"]
|
||||||
six.assertCountEqual(self, module_info.keys(), expectedKeys)
|
self.assertCountEqual(module_info.keys(), expectedKeys)
|
||||||
|
|
||||||
def test_nvr(self):
|
def test_nvr(self):
|
||||||
module_info = source_koji.variant_dict_from_str(self.compose, self.nvr)
|
module_info = source_koji.variant_dict_from_str(self.compose, self.nvr)
|
||||||
expectedKeys = ["stream", "name", "version"]
|
expectedKeys = ["stream", "name", "version"]
|
||||||
six.assertCountEqual(self, module_info.keys(), expectedKeys)
|
self.assertCountEqual(module_info.keys(), expectedKeys)
|
||||||
|
|
||||||
def test_correct_release(self):
|
def test_correct_release(self):
|
||||||
module_info = source_koji.variant_dict_from_str(self.compose, self.nvr)
|
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)
|
result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag)
|
||||||
|
|
||||||
six.assertCountEqual(self, result, [m1])
|
self.assertCountEqual(result, [m1])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
koji_proxy.mock_calls,
|
koji_proxy.mock_calls,
|
||||||
[mock.call.getFullInheritance("top-tag", event=123456)],
|
[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)
|
result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag)
|
||||||
|
|
||||||
six.assertCountEqual(self, result, [m3])
|
self.assertCountEqual(result, [m3])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
koji_proxy.mock_calls,
|
koji_proxy.mock_calls,
|
||||||
[mock.call.getFullInheritance("top-tag", event=123456)],
|
[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)
|
result = source_koji.filter_inherited(koji_proxy, event, module_builds, top_tag)
|
||||||
|
|
||||||
six.assertCountEqual(self, result, [m])
|
self.assertCountEqual(result, [m])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
koji_proxy.mock_calls,
|
koji_proxy.mock_calls,
|
||||||
[mock.call.getFullInheritance("top-tag", event=123456)],
|
[mock.call.getFullInheritance("top-tag", event=123456)],
|
||||||
@ -662,7 +657,7 @@ class TestFilterByWhitelist(unittest.TestCase):
|
|||||||
compose, module_builds, input_modules, expected
|
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())
|
self.assertEqual(expected, set())
|
||||||
|
|
||||||
def test_filter_by_NSV(self):
|
def test_filter_by_NSV(self):
|
||||||
@ -714,7 +709,7 @@ class TestFilterByWhitelist(unittest.TestCase):
|
|||||||
compose, module_builds, input_modules, expected
|
compose, module_builds, input_modules, expected
|
||||||
)
|
)
|
||||||
|
|
||||||
six.assertCountEqual(self, result, module_builds)
|
self.assertCountEqual(result, module_builds)
|
||||||
self.assertEqual(expected, set())
|
self.assertEqual(expected, set())
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
import six
|
|
||||||
|
|
||||||
import pungi.phases.repoclosure as repoclosure_phase
|
import pungi.phases.repoclosure as repoclosure_phase
|
||||||
from tests.helpers import DummyCompose, PungiTestCase, mk_boom
|
from tests.helpers import DummyCompose, PungiTestCase, mk_boom
|
||||||
@ -35,8 +34,7 @@ class TestRepoclosure(PungiTestCase):
|
|||||||
compose = DummyCompose(self.topdir, {"repoclosure_backend": "dnf"})
|
compose = DummyCompose(self.topdir, {"repoclosure_backend": "dnf"})
|
||||||
repoclosure_phase.run_repoclosure(compose)
|
repoclosure_phase.run_repoclosure(compose)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
mock_grc.call_args_list,
|
mock_grc.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -89,8 +87,7 @@ class TestRepoclosure(PungiTestCase):
|
|||||||
repoclosure_phase.run_repoclosure(compose)
|
repoclosure_phase.run_repoclosure(compose)
|
||||||
|
|
||||||
self.assertEqual(mock_grc.call_args_list, [])
|
self.assertEqual(mock_grc.call_args_list, [])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
effl.call_args_list,
|
effl.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call([f], _log("amd64", "Everything")),
|
mock.call([f], _log("amd64", "Everything")),
|
||||||
@ -129,8 +126,7 @@ class TestRepoclosure(PungiTestCase):
|
|||||||
)
|
)
|
||||||
repoclosure_phase.run_repoclosure(compose)
|
repoclosure_phase.run_repoclosure(compose)
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
mock_grc.call_args_list,
|
mock_grc.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi.wrappers import repoclosure as rc
|
from pungi.wrappers import repoclosure as rc
|
||||||
|
|
||||||
@ -26,8 +25,7 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase):
|
|||||||
backend="dnf", arch="x86_64", repos=repos, lookaside=lookaside
|
backend="dnf", arch="x86_64", repos=repos, lookaside=lookaside
|
||||||
)
|
)
|
||||||
self.assertEqual(cmd[:2], ["dnf", "repoclosure"])
|
self.assertEqual(cmd[:2], ["dnf", "repoclosure"])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[2:],
|
cmd[2:],
|
||||||
[
|
[
|
||||||
"--arch=x86_64",
|
"--arch=x86_64",
|
||||||
@ -51,8 +49,7 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase):
|
|||||||
lookaside=lookaside,
|
lookaside=lookaside,
|
||||||
)
|
)
|
||||||
self.assertEqual(cmd[:2], ["dnf", "repoclosure"])
|
self.assertEqual(cmd[:2], ["dnf", "repoclosure"])
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
cmd[2:],
|
cmd[2:],
|
||||||
[
|
[
|
||||||
"--arch=x86_64",
|
"--arch=x86_64",
|
||||||
|
@ -10,8 +10,6 @@ import unittest
|
|||||||
import http.server
|
import http.server
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
from pungi.wrappers import scm
|
from pungi.wrappers import scm
|
||||||
@ -28,7 +26,7 @@ class SCMBaseTest(unittest.TestCase):
|
|||||||
|
|
||||||
def assertStructure(self, returned, expected):
|
def assertStructure(self, returned, expected):
|
||||||
# Check we returned the correct files
|
# Check we returned the correct files
|
||||||
six.assertCountEqual(self, returned, expected)
|
self.assertCountEqual(returned, expected)
|
||||||
|
|
||||||
# Each file must exist
|
# Each file must exist
|
||||||
for f in expected:
|
for f in expected:
|
||||||
@ -40,7 +38,7 @@ class SCMBaseTest(unittest.TestCase):
|
|||||||
for f in files:
|
for f in files:
|
||||||
p = os.path.relpath(os.path.join(root, f), self.destdir)
|
p = os.path.relpath(os.path.join(root, f), self.destdir)
|
||||||
found.append(p)
|
found.append(p)
|
||||||
six.assertCountEqual(self, expected, found)
|
self.assertCountEqual(expected, found)
|
||||||
|
|
||||||
|
|
||||||
class FileSCMTestCase(SCMBaseTest):
|
class FileSCMTestCase(SCMBaseTest):
|
||||||
@ -598,7 +596,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertStructure(retval, ["some-file-1.txt", "some-file-2.txt"])
|
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")
|
@mock.patch("pungi.wrappers.scm.explode_rpm_package")
|
||||||
def test_get_files_from_glob_rpms(self, explode):
|
def test_get_files_from_glob_rpms(self, explode):
|
||||||
@ -622,7 +620,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
"some-file-4.txt",
|
"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")
|
@mock.patch("pungi.wrappers.scm.explode_rpm_package")
|
||||||
def test_get_dir_from_two_rpms(self, explode):
|
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"])
|
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")
|
@mock.patch("pungi.wrappers.scm.explode_rpm_package")
|
||||||
def test_get_dir_from_glob_rpms(self, explode):
|
def test_get_dir_from_glob_rpms(self, explode):
|
||||||
@ -651,7 +649,7 @@ class RpmSCMTestCase(SCMBaseTest):
|
|||||||
self.assertStructure(
|
self.assertStructure(
|
||||||
retval, ["foo-1.txt", "foo-2.txt", "foo-3.txt", "foo-4.txt"]
|
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):
|
class CvsSCMTestCase(SCMBaseTest):
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import six
|
from configparser import ConfigParser
|
||||||
from six.moves.configparser import ConfigParser
|
|
||||||
|
|
||||||
from tests.helpers import PungiTestCase, FIXTURE_DIR, touch, mk_boom
|
from tests.helpers import PungiTestCase, FIXTURE_DIR, touch, mk_boom
|
||||||
from pungi_utils import unified_isos
|
from pungi_utils import unified_isos
|
||||||
@ -185,8 +184,7 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
def test_link_to_temp(self):
|
def test_link_to_temp(self):
|
||||||
self.isos.link_to_temp()
|
self.isos.link_to_temp()
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
self.isos.treeinfo.keys(),
|
self.isos.treeinfo.keys(),
|
||||||
[
|
[
|
||||||
"i386",
|
"i386",
|
||||||
@ -202,8 +200,7 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
self.assertEqual(self.isos.productid, get_productid_mapping(self.compose_path))
|
self.assertEqual(self.isos.productid, get_productid_mapping(self.compose_path))
|
||||||
self.assertEqual(self.isos.repos, get_repos_mapping(self.isos.temp_dir))
|
self.assertEqual(self.isos.repos, get_repos_mapping(self.isos.temp_dir))
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
self.isos.linker.link.call_args_list,
|
self.isos.linker.link.call_args_list,
|
||||||
[
|
[
|
||||||
self._linkCall(
|
self._linkCall(
|
||||||
@ -239,8 +236,7 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
with mock.patch("sys.stderr"):
|
with mock.patch("sys.stderr"):
|
||||||
self.isos.link_to_temp()
|
self.isos.link_to_temp()
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
self.isos.treeinfo.keys(),
|
self.isos.treeinfo.keys(),
|
||||||
["s390x", "src", "x86_64", "debug-s390x", "debug-x86_64"],
|
["s390x", "src", "x86_64", "debug-s390x", "debug-x86_64"],
|
||||||
)
|
)
|
||||||
@ -257,8 +253,7 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
|
|
||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
self.isos.linker.link.call_args_list,
|
self.isos.linker.link.call_args_list,
|
||||||
[
|
[
|
||||||
self._linkCall(
|
self._linkCall(
|
||||||
@ -290,8 +285,7 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
|
|
||||||
self.isos.link_to_temp()
|
self.isos.link_to_temp()
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
self.isos.treeinfo.keys(),
|
self.isos.treeinfo.keys(),
|
||||||
[
|
[
|
||||||
"i386",
|
"i386",
|
||||||
@ -307,8 +301,7 @@ class TestLinkToTemp(PungiTestCase):
|
|||||||
self.assertEqual(self.isos.productid, get_productid_mapping(self.compose_path))
|
self.assertEqual(self.isos.productid, get_productid_mapping(self.compose_path))
|
||||||
self.assertEqual(self.isos.repos, get_repos_mapping(self.isos.temp_dir))
|
self.assertEqual(self.isos.repos, get_repos_mapping(self.isos.temp_dir))
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
self.isos.linker.link.call_args_list,
|
self.isos.linker.link.call_args_list,
|
||||||
[
|
[
|
||||||
self._linkCall(
|
self._linkCall(
|
||||||
@ -372,8 +365,7 @@ class TestCreaterepo(PungiTestCase):
|
|||||||
cr.return_value.get_createrepo_cmd.side_effect = self.mock_cr
|
cr.return_value.get_createrepo_cmd.side_effect = self.mock_cr
|
||||||
self.isos.createrepo()
|
self.isos.createrepo()
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
run.call_args_list,
|
run.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(("src/Client", None), show_cmd=True),
|
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
|
cr.return_value.get_modifyrepo_cmd.side_effect = self.mock_mr
|
||||||
self.isos.createrepo()
|
self.isos.createrepo()
|
||||||
|
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
run.call_args_list,
|
run.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(("src/Client", None), show_cmd=True),
|
mock.call(("src/Client", None), show_cmd=True),
|
||||||
@ -527,8 +518,7 @@ class TestDiscinfo(PungiTestCase):
|
|||||||
@mock.patch("pungi_utils.unified_isos.create_discinfo")
|
@mock.patch("pungi_utils.unified_isos.create_discinfo")
|
||||||
def test_discinfo(self, create_discinfo):
|
def test_discinfo(self, create_discinfo):
|
||||||
self.isos.discinfo()
|
self.isos.discinfo()
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
create_discinfo.call_args_list,
|
create_discinfo.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
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.iso")
|
||||||
@mock.patch("pungi_utils.unified_isos.run")
|
@mock.patch("pungi_utils.unified_isos.run")
|
||||||
@ -758,8 +748,7 @@ class TestUpdateChecksums(PungiTestCase):
|
|||||||
@mock.patch("pungi_utils.unified_isos.make_checksums")
|
@mock.patch("pungi_utils.unified_isos.make_checksums")
|
||||||
def test_update_checksums(self, mmc):
|
def test_update_checksums(self, mmc):
|
||||||
self.isos.update_checksums()
|
self.isos.update_checksums()
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
mmc.call_args_list,
|
mmc.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
@ -776,8 +765,7 @@ class TestUpdateChecksums(PungiTestCase):
|
|||||||
def test_update_checksums_one_file(self, mmc):
|
def test_update_checksums_one_file(self, mmc):
|
||||||
self.isos.conf["media_checksum_one_file"] = True
|
self.isos.conf["media_checksum_one_file"] = True
|
||||||
self.isos.update_checksums()
|
self.isos.update_checksums()
|
||||||
six.assertCountEqual(
|
self.assertCountEqual(
|
||||||
self,
|
|
||||||
mmc.call_args_list,
|
mmc.call_args_list,
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
|
@ -8,7 +8,6 @@ import unittest
|
|||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import six
|
|
||||||
|
|
||||||
from pungi import compose
|
from pungi import compose
|
||||||
from pungi import util
|
from pungi import util
|
||||||
@ -251,7 +250,7 @@ class TestGetVariantData(unittest.TestCase):
|
|||||||
def test_get_make_list(self):
|
def test_get_make_list(self):
|
||||||
conf = {"foo": {"^Client$": [1, 2], "^.*$": 3}}
|
conf = {"foo": {"^Client$": [1, 2], "^.*$": 3}}
|
||||||
result = util.get_variant_data(conf, "foo", mock.Mock(uid="Client"))
|
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):
|
def test_not_matching_arch(self):
|
||||||
conf = {"foo": {"^Client$": [1, 2]}}
|
conf = {"foo": {"^Client$": [1, 2]}}
|
||||||
@ -1050,7 +1049,7 @@ class TestMoveAll(PungiTestCase):
|
|||||||
self.assertFalse(os.path.isfile(os.path.join(self.src, "target")))
|
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):
|
class TestAsLocalFile(PungiTestCase):
|
||||||
def test_local_file(self, urlretrieve):
|
def test_local_file(self, urlretrieve):
|
||||||
with util.as_local_file("/tmp/foo") as fn:
|
with util.as_local_file("/tmp/foo") as fn:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from six.moves import cStringIO
|
from io import StringIO
|
||||||
|
|
||||||
from pungi.wrappers.variants import VariantsXmlParser
|
from pungi.wrappers.variants import VariantsXmlParser
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ VARIANTS_WITH_WHITESPACE = """
|
|||||||
|
|
||||||
class TestVariantsXmlParser(unittest.TestCase):
|
class TestVariantsXmlParser(unittest.TestCase):
|
||||||
def test_whitespace_in_file(self):
|
def test_whitespace_in_file(self):
|
||||||
input = cStringIO(VARIANTS_WITH_WHITESPACE)
|
input = StringIO(VARIANTS_WITH_WHITESPACE)
|
||||||
|
|
||||||
with self.assertRaises(ValueError) as ctx:
|
with self.assertRaises(ValueError) as ctx:
|
||||||
VariantsXmlParser(input)
|
VariantsXmlParser(input)
|
||||||
|
Loading…
Reference in New Issue
Block a user