diff --git a/pungi/phases/gather/methods/method_nodeps.py b/pungi/phases/gather/methods/method_nodeps.py index bb5d8548..931add36 100644 --- a/pungi/phases/gather/methods/method_nodeps.py +++ b/pungi/phases/gather/methods/method_nodeps.py @@ -90,9 +90,7 @@ class GatherMethodNodeps(pungi.phases.gather.method.GatherMethodBase): and pkg.arch != "noarch" ): continue - result["rpm"].append( - {"path": pkg.file_path, "flags": ["input"]} - ) + result["rpm"].append({"path": pkg.file_path, "flags": ["input"]}) seen_rpms.setdefault(pkg.name, set()).add(pkg.arch) seen_srpms.setdefault(pkg.sourcerpm, set()).add(pkg.arch) log.write( @@ -105,9 +103,7 @@ class GatherMethodNodeps(pungi.phases.gather.method.GatherMethodBase): if not pkg_is_srpm(pkg): continue if pkg.file_name in seen_srpms: - result["srpm"].append( - {"path": pkg.file_path, "flags": ["input"]} - ) + result["srpm"].append({"path": pkg.file_path, "flags": ["input"]}) log.write("Adding %s\n" % pkg) log.write("\nGathering debuginfo packages\n") @@ -125,9 +121,7 @@ class GatherMethodNodeps(pungi.phases.gather.method.GatherMethodBase): # pull debuginfo (they would pull in all architectures). log.write("Not including %s: no package for this arch\n" % pkg) continue - result["debuginfo"].append( - {"path": pkg.file_path, "flags": ["input"]} - ) + result["debuginfo"].append({"path": pkg.file_path, "flags": ["input"]}) log.write("Adding %s\n" % pkg) return result diff --git a/pungi/phases/osbs.py b/pungi/phases/osbs.py index 218eeaf4..148b3c3e 100644 --- a/pungi/phases/osbs.py +++ b/pungi/phases/osbs.py @@ -143,9 +143,7 @@ class OSBSThread(WorkerThread): result = koji.koji_proxy.getTaskResult(task_id) if is_scratch: - metadata.update( - {"repositories": result["repositories"]} - ) + metadata.update({"repositories": result["repositories"]}) # add a fake arch of 'scratch', so we can construct the metadata # in same data structure as real builds. self.pool.metadata.setdefault(variant.uid, {}).setdefault( diff --git a/pungi/scripts/config_validate.py b/pungi/scripts/config_validate.py index f575b362..28e7b5f3 100644 --- a/pungi/scripts/config_validate.py +++ b/pungi/scripts/config_validate.py @@ -181,20 +181,26 @@ def main(args=None): ), ) parser.add_argument( - '--schema-override', + "--schema-override", action="append", default=[], help=( - 'Path to extra JSON schema defining the values which will override ' - 'the original Pungi JSON schema values.' + "Path to extra JSON schema defining the values which will override " + "the original Pungi JSON schema values." ), ) opts = parser.parse_args(args) defines = config_utils.extract_defines(opts.define) with pungi.util.temp_dir() as topdir: - errors = run(opts.config, topdir, opts.old_composes, opts.offline, defines, - opts.schema_override) + errors = run( + opts.config, + topdir, + opts.old_composes, + opts.offline, + defines, + opts.schema_override, + ) for msg in errors: print(msg) diff --git a/tests/test_checks.py b/tests/test_checks.py index 93ee0a29..6dfc3977 100644 --- a/tests/test_checks.py +++ b/tests/test_checks.py @@ -582,12 +582,8 @@ class TestSchemaValidator(unittest.TestCase): "definitions": { "scm_dict": { "properties": { - "scm": { - "enum": ["git"] - }, - "repo": { - "enum": ["git://localhost/pungi-fedora.git"] - }, + "scm": {"enum": ["git"]}, + "repo": {"enum": ["git://localhost/pungi-fedora.git"]}, } } } @@ -595,11 +591,12 @@ class TestSchemaValidator(unittest.TestCase): schema = checks.update_schema(schema, schema_override) scm_dict_properties = schema["definitions"]["scm_dict"]["properties"] self.assertEqual( - scm_dict_properties["scm"], - {'enum': ['git'], 'type': 'string'}) + scm_dict_properties["scm"], {"enum": ["git"], "type": "string"} + ) self.assertEqual( scm_dict_properties["repo"], - {'enum': ['git://localhost/pungi-fedora.git'], 'type': 'string'}) + {"enum": ["git://localhost/pungi-fedora.git"], "type": "string"}, + ) self.assertEqual(scm_dict_properties["file"], {"type": "string"}) diff --git a/tests/test_config_validate_script.py b/tests/test_config_validate_script.py index afafceaf..4f9c64bf 100644 --- a/tests/test_config_validate_script.py +++ b/tests/test_config_validate_script.py @@ -10,29 +10,37 @@ from tests import helpers HERE = os.path.abspath(os.path.dirname(__file__)) -DUMMY_CONFIG = os.path.join(HERE, 'data/dummy-pungi.conf') -SCHEMA_OVERRIDE = os.path.join(HERE, 'data/dummy-override.json') +DUMMY_CONFIG = os.path.join(HERE, "data/dummy-pungi.conf") +SCHEMA_OVERRIDE = os.path.join(HERE, "data/dummy-override.json") class ConfigValidateScriptTest(helpers.PungiTestCase): - - @mock.patch('sys.argv', new=['pungi-config-validate', DUMMY_CONFIG]) - @mock.patch('sys.stderr', new_callable=six.StringIO) - @mock.patch('sys.stdout', new_callable=six.StringIO) + @mock.patch("sys.argv", new=["pungi-config-validate", DUMMY_CONFIG]) + @mock.patch("sys.stderr", new_callable=six.StringIO) + @mock.patch("sys.stdout", new_callable=six.StringIO) def test_validate_dummy_config(self, stdout, stderr): cli_main() - self.assertEqual('', stdout.getvalue()) - self.assertEqual('', stderr.getvalue()) + self.assertEqual("", stdout.getvalue()) + self.assertEqual("", stderr.getvalue()) - @mock.patch('sys.argv', new=[ - 'pungi-config-validate', DUMMY_CONFIG, "--schema-override", - SCHEMA_OVERRIDE]) - @mock.patch('sys.stderr', new_callable=six.StringIO) - @mock.patch('sys.stdout', new_callable=six.StringIO) - @mock.patch('sys.exit') + @mock.patch( + "sys.argv", + new=[ + "pungi-config-validate", + DUMMY_CONFIG, + "--schema-override", + SCHEMA_OVERRIDE, + ], + ) + @mock.patch("sys.stderr", new_callable=six.StringIO) + @mock.patch("sys.stdout", new_callable=six.StringIO) + @mock.patch("sys.exit") def test_schema_override(self, exit, stdout, stderr): cli_main() - self.assertTrue(stdout.getvalue().startswith( - "Failed validation in pkgset_source: 'repos' is not one of")) - self.assertEqual('', stderr.getvalue()) + self.assertTrue( + stdout.getvalue().startswith( + "Failed validation in pkgset_source: 'repos' is not one of" + ) + ) + self.assertEqual("", stderr.getvalue()) exit.assert_called_once_with(1)