Fix flake8 issues

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2020-05-26 11:49:40 +02:00
parent 694b7f3d28
commit 59e2aa9607
5 changed files with 5 additions and 46 deletions

View File

@ -94,7 +94,7 @@ class GatherOptions(pungi.common.OptionsBase):
"exclude_source=%s" % self.exclude_source, "exclude_source=%s" % self.exclude_source,
"exclude_debug=%s" % self.exclude_debug, "exclude_debug=%s" % self.exclude_debug,
] ]
return "[\n%s\n]" % "\n".join(" " + l for l in lines) return "[\n%s\n]" % "\n".join(" " + line for line in lines)
class QueryCache(object): class QueryCache(object):

View File

@ -111,7 +111,7 @@ def create_variant_repo(
if variant.is_empty or (arch is None and pkg_type != "srpm"): if variant.is_empty or (arch is None and pkg_type != "srpm"):
compose.log_info( compose.log_info(
"[SKIP ] Creating repo (arch: %s, variant: %s): %s" % (arch, variant) "[SKIP ] Creating repo (arch: %s, variant: %s)" % (arch, variant)
) )
return return

View File

@ -1130,27 +1130,6 @@ class TestReuseOldGatherPackages(helpers.PungiTestCase):
) )
self.assertEqual(result, None) self.assertEqual(result, None)
@mock.patch("pungi.phases.gather.load_old_gather_result")
@mock.patch("pungi.phases.gather.load_old_compose_config")
def test_reuse_compose_config_different(
self, load_old_compose_config, load_old_gather_result
):
load_old_gather_result.return_value = {
"rpm": [{"path": "/build/bash-1.0.0-1.x86_64.rpm"}],
"srpm": [],
"debuginfo": [],
}
compose = helpers.DummyCompose(self.topdir, {"gather_allow_reuse": True})
compose_conf_copy = dict(compose.conf)
compose_conf_copy["gather_method"] = "nodeps"
load_old_compose_config.return_value = compose_conf_copy
result = gather.reuse_old_gather_packages(
compose, "x86_64", compose.variants["Server"], []
)
self.assertEqual(result, None)
@mock.patch("pungi.phases.gather.load_old_gather_result") @mock.patch("pungi.phases.gather.load_old_gather_result")
@mock.patch("pungi.phases.gather.load_old_compose_config") @mock.patch("pungi.phases.gather.load_old_compose_config")
def test_reuse_compose_config_different_whitelist( def test_reuse_compose_config_different_whitelist(
@ -1276,25 +1255,6 @@ class TestReuseOldGatherPackages(helpers.PungiTestCase):
) )
self.assertEqual(result, None) self.assertEqual(result, None)
@mock.patch("pungi.phases.gather.load_old_gather_result")
@mock.patch("pungi.phases.gather.load_old_compose_config")
def test_reuse_no_old_file_cache(
self, load_old_compose_config, load_old_gather_result
):
package_sets = self._prepare_package_sets(
load_old_gather_result, requires=[], provides=[]
)
package_sets[0]["global"].old_file_cache = {
"/build/foo-1-1.x86_64.rpm": MockPkg("foo-1-1.x86_64.rpm", sourcerpm="foo")
}
compose = helpers.DummyCompose(self.topdir, {"gather_allow_reuse": True})
load_old_compose_config.return_value = compose.conf
result = gather.reuse_old_gather_packages(
compose, "x86_64", compose.variants["Server"], package_sets
)
self.assertEqual(result, None)
@mock.patch("pungi.phases.gather.load_old_gather_result") @mock.patch("pungi.phases.gather.load_old_gather_result")
@mock.patch("pungi.phases.gather.load_old_compose_config") @mock.patch("pungi.phases.gather.load_old_compose_config")
def test_reuse_two_rpms_from_same_source( def test_reuse_two_rpms_from_same_source(

View File

@ -636,9 +636,7 @@ class TestCreateiso(PungiTestCase):
if a.startswith("debug-"): if a.startswith("debug-"):
iso_arch += "-debuginfo" iso_arch += "-debuginfo"
a = a.split("-", 1)[1] a = a.split("-", 1)[1]
path = "{0}/{1}/iso/DP-1.0-20161013.t.4-{1}-dvd.iso".format( path = "{0}/{1}/iso/DP-1.0-20161013.t.4-{1}-dvd.iso".format(v, arch)
v, arch, iso_arch
)
if image.unified and image.arch == a and image.path == path: if image.unified and image.arch == a and image.path == path:
break break
else: else:

View File

@ -4,8 +4,9 @@ envlist = py27, py36
[testenv] [testenv]
deps = deps =
flake8 flake8
whitelist_externals = sh
commands = commands =
flake8 pungi pungi_utils setup.py tests/*py sh -c "flake8 pungi pungi_utils setup.py tests/*py"
[testenv:py36] [testenv:py36]
deps = deps =