diff options
Diffstat (limited to 'tests/frontend/mirror.py')
-rw-r--r-- | tests/frontend/mirror.py | 58 |
1 files changed, 12 insertions, 46 deletions
diff --git a/tests/frontend/mirror.py b/tests/frontend/mirror.py index dbd21e1e9..1146893cd 100644 --- a/tests/frontend/mirror.py +++ b/tests/frontend/mirror.py @@ -48,9 +48,7 @@ def generate_project(): {"name": "arrakis", "aliases": {"foo": ["OFO/"], "bar": ["RBA/"],},}, {"name": "oz", "aliases": {"foo": ["ooF/"], "bar": ["raB/"],}}, ], - "plugins": [ - {"origin": "local", "path": "sources", "sources": {"fetch_source": 0}} - ], + "plugins": [{"origin": "local", "path": "sources", "sources": {"fetch_source": 0}}], } return project @@ -75,11 +73,7 @@ def test_mirror_fetch_ref_storage(cli, tmpdir, datafiles, ref_storage, mirror): element = { "kind": "import", - "sources": [ - upstream_repo.source_config( - ref=upstream_ref if ref_storage == "inline" else None - ) - ], + "sources": [upstream_repo.source_config(ref=upstream_ref if ref_storage == "inline" else None)], } element_name = "test.bst" element_path = os.path.join(element_dir, element_name) @@ -109,11 +103,7 @@ def test_mirror_fetch_ref_storage(cli, tmpdir, datafiles, ref_storage, mirror): mirror_data = [{"name": "middle-earth", "aliases": {alias: [mirror_map + "/"]}}] if mirror == "unrelated-mirror": mirror_data.insert( - 0, - { - "name": "narnia", - "aliases": {"frob": ["http://www.example.com/repo"]}, - }, + 0, {"name": "narnia", "aliases": {"frob": ["http://www.example.com/repo"]},}, ) project["mirrors"] = mirror_data @@ -164,10 +154,7 @@ def test_mirror_fetch_default_cmdline(cli, tmpdir): project = generate_project() _yaml.roundtrip_dump(project, project_file) - result = cli.run( - project=project_dir, - args=["--default-mirror", "arrakis", "source", "fetch", element_name], - ) + result = cli.run(project=project_dir, args=["--default-mirror", "arrakis", "source", "fetch", element_name],) result.assert_success() with open(output_file) as f: contents = f.read() @@ -179,9 +166,7 @@ def test_mirror_fetch_default_cmdline(cli, tmpdir): me_str = "OOF/repo1" me_pos = contents.find(me_str) assert me_pos != -1, "'{}' wasn't found".format(me_str) - assert arrakis_pos < me_pos, "'{}' wasn't found before '{}'".format( - arrakis_str, me_str - ) + assert arrakis_pos < me_pos, "'{}' wasn't found before '{}'".format(arrakis_str, me_str) @pytest.mark.datafiles(DATA_DIR) @@ -237,10 +222,7 @@ def test_mirror_fetch_default_cmdline_overrides_config(cli, tmpdir): userconfig = {"projects": {"test": {"default-mirror": "oz"}}} cli.configure(userconfig) - result = cli.run( - project=project_dir, - args=["--default-mirror", "arrakis", "source", "fetch", element_name], - ) + result = cli.run(project=project_dir, args=["--default-mirror", "arrakis", "source", "fetch", element_name],) result.assert_success() with open(output_file) as f: contents = f.read() @@ -252,9 +234,7 @@ def test_mirror_fetch_default_cmdline_overrides_config(cli, tmpdir): me_str = "OOF/repo1" me_pos = contents.find(me_str) assert me_pos != -1, "'{}' wasn't found".format(me_str) - assert arrakis_pos < me_pos, "'{}' wasn't found before '{}'".format( - arrakis_str, me_str - ) + assert arrakis_pos < me_pos, "'{}' wasn't found before '{}'".format(arrakis_str, me_str) @pytest.mark.datafiles(DATA_DIR) @@ -317,9 +297,7 @@ def test_mirror_git_submodule_fetch(cli, tmpdir, datafiles): "name": "test", "element-path": "elements", "aliases": {alias: "http://www.example.com/"}, - "mirrors": [ - {"name": "middle-earth", "aliases": {alias: [mirror_map + "/"],},}, - ], + "mirrors": [{"name": "middle-earth", "aliases": {alias: [mirror_map + "/"],},},], } project_file = os.path.join(project_dir, "project.conf") _yaml.roundtrip_dump(project, project_file) @@ -382,9 +360,7 @@ def test_mirror_fallback_git_only_submodules(cli, tmpdir, datafiles): element = { "kind": "import", - "sources": [ - main_repo.source_config_extra(ref=main_ref, checkout_submodules=True) - ], + "sources": [main_repo.source_config_extra(ref=main_ref, checkout_submodules=True)], } element_name = "test.bst" element_path = os.path.join(element_dir, element_name) @@ -409,10 +385,7 @@ def test_mirror_fallback_git_only_submodules(cli, tmpdir, datafiles): result.assert_success() checkout = os.path.join(str(tmpdir), "checkout") - result = cli.run( - project=project_dir, - args=["artifact", "checkout", element_name, "--directory", checkout], - ) + result = cli.run(project=project_dir, args=["artifact", "checkout", element_name, "--directory", checkout],) result.assert_success() assert os.path.exists(os.path.join(checkout, "bin", "bin", "hello")) @@ -471,11 +444,7 @@ def test_mirror_fallback_git_with_submodules(cli, tmpdir, datafiles): element = { "kind": "import", - "sources": [ - upstream_main_repo.source_config_extra( - ref=upstream_main_ref, checkout_submodules=True - ) - ], + "sources": [upstream_main_repo.source_config_extra(ref=upstream_main_ref, checkout_submodules=True)], } element["sources"][0]["url"] = aliased_repo element_name = "test.bst" @@ -501,10 +470,7 @@ def test_mirror_fallback_git_with_submodules(cli, tmpdir, datafiles): result.assert_success() checkout = os.path.join(str(tmpdir), "checkout") - result = cli.run( - project=project_dir, - args=["artifact", "checkout", element_name, "--directory", checkout], - ) + result = cli.run(project=project_dir, args=["artifact", "checkout", element_name, "--directory", checkout],) result.assert_success() assert os.path.exists(os.path.join(checkout, "bin", "bin", "hello")) |