diff options
Diffstat (limited to 'src/buildstream/testing/_sourcetests/track.py')
-rw-r--r-- | src/buildstream/testing/_sourcetests/track.py | 65 |
1 files changed, 13 insertions, 52 deletions
diff --git a/src/buildstream/testing/_sourcetests/track.py b/src/buildstream/testing/_sourcetests/track.py index c857e246d..8c54f6259 100644 --- a/src/buildstream/testing/_sourcetests/track.py +++ b/src/buildstream/testing/_sourcetests/track.py @@ -138,18 +138,14 @@ def test_track_recurse(cli, tmpdir, datafiles, kind, amount): assert states[element_name] == "no reference" # Now first try to track it - result = cli.run( - project=project, args=["source", "track", "--deps", "all", last_element_name] - ) + result = cli.run(project=project, args=["source", "track", "--deps", "all", last_element_name]) result.assert_success() # And now fetch it: The Source has probably already cached the # latest ref locally, but it is not required to have cached # the associated content of the latest ref at track time, that # is the job of fetch. - result = cli.run( - project=project, args=["source", "fetch", "--deps", "all", last_element_name] - ) + result = cli.run(project=project, args=["source", "fetch", "--deps", "all", last_element_name]) result.assert_success() # Assert that the base is buildable and the rest are waiting @@ -177,9 +173,7 @@ def test_track_recurse_except(cli, tmpdir, datafiles, kind): # Write out our test targets generate_element(repo, os.path.join(element_path, element_dep_name)) - generate_element( - repo, os.path.join(element_path, element_target_name), dep_name=element_dep_name - ) + generate_element(repo, os.path.join(element_path, element_target_name), dep_name=element_dep_name) # Assert that a fetch is needed states = cli.get_element_states(project, [element_target_name]) @@ -188,16 +182,7 @@ def test_track_recurse_except(cli, tmpdir, datafiles, kind): # Now first try to track it result = cli.run( - project=project, - args=[ - "source", - "track", - "--deps", - "all", - "--except", - element_dep_name, - element_target_name, - ], + project=project, args=["source", "track", "--deps", "all", "--except", element_dep_name, element_target_name,], ) result.assert_success() @@ -205,9 +190,7 @@ def test_track_recurse_except(cli, tmpdir, datafiles, kind): # latest ref locally, but it is not required to have cached # the associated content of the latest ref at track time, that # is the job of fetch. - result = cli.run( - project=project, args=["source", "fetch", "--deps", "none", element_target_name] - ) + result = cli.run(project=project, args=["source", "fetch", "--deps", "none", element_target_name]) result.assert_success() # Assert that the dependency is buildable and the target is waiting @@ -233,25 +216,17 @@ def test_cross_junction(cli, tmpdir, datafiles, ref_storage, kind): generate_element(repo, repo_element_path) generate_junction( - str(tmpdir.join("junction_repo")), - subproject_path, - junction_path, - store_ref=False, + str(tmpdir.join("junction_repo")), subproject_path, junction_path, store_ref=False, ) # Track the junction itself first. result = cli.run(project=project, args=["source", "track", "junction.bst"]) result.assert_success() - assert ( - cli.get_element_state(project, "junction.bst:import-etc-repo.bst") - == "no reference" - ) + assert cli.get_element_state(project, "junction.bst:import-etc-repo.bst") == "no reference" # Track the cross junction element. -J is not given, it is implied. - result = cli.run( - project=project, args=["source", "track", "junction.bst:import-etc-repo.bst"] - ) + result = cli.run(project=project, args=["source", "track", "junction.bst:import-etc-repo.bst"]) if ref_storage == "inline": # This is not allowed to track cross junction without project.refs. @@ -259,10 +234,7 @@ def test_cross_junction(cli, tmpdir, datafiles, ref_storage, kind): else: result.assert_success() - assert ( - cli.get_element_state(project, "junction.bst:import-etc-repo.bst") - == "buildable" - ) + assert cli.get_element_state(project, "junction.bst:import-etc-repo.bst") == "buildable" assert os.path.exists(os.path.join(project, "project.refs")) @@ -354,10 +326,7 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind): _yaml.roundtrip_dump(sources, os.path.join(sub_element_path, "sources.yml")) generate_junction( - str(tmpdir.join("junction_repo")), - subproject_path, - junction_path, - store_ref=True, + str(tmpdir.join("junction_repo")), subproject_path, junction_path, store_ref=True, ) result = cli.run(project=project, args=["source", "track", "junction.bst"]) @@ -374,10 +343,7 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind): # FIXME: We should expect an error. But only a warning is emitted # result.assert_main_error(ErrorDomain.SOURCE, 'tracking-junction-fragment') - assert ( - "junction.bst:elements/sources.yml: Cannot track source in a fragment from a junction" - in result.stderr - ) + assert "junction.bst:elements/sources.yml: Cannot track source in a fragment from a junction" in result.stderr else: assert os.path.exists(os.path.join(project, "project.refs")) @@ -401,15 +367,10 @@ def test_track_junction_included(cli, tmpdir, datafiles, ref_storage, kind): subproject_path = os.path.join(project, "files", "sub-project") junction_path = os.path.join(element_path, "junction.bst") - update_project_configuration( - project, {"ref-storage": ref_storage, "(@)": ["junction.bst:test.yml"]} - ) + update_project_configuration(project, {"ref-storage": ref_storage, "(@)": ["junction.bst:test.yml"]}) generate_junction( - str(tmpdir.join("junction_repo")), - subproject_path, - junction_path, - store_ref=False, + str(tmpdir.join("junction_repo")), subproject_path, junction_path, store_ref=False, ) result = cli.run(project=project, args=["source", "track", "junction.bst"]) |