summaryrefslogtreecommitdiff
path: root/tests/sources/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sources/git.py')
-rw-r--r--tests/sources/git.py106
1 files changed, 24 insertions, 82 deletions
diff --git a/tests/sources/git.py b/tests/sources/git.py
index 6a6f95364..fb8a30e3f 100644
--- a/tests/sources/git.py
+++ b/tests/sources/git.py
@@ -84,10 +84,7 @@ def test_submodule_fetch_checkout(cli, tmpdir, datafiles):
result.assert_success()
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],)
result.assert_success()
# Assert we checked out both files at their expected location
@@ -124,10 +121,7 @@ def test_submodule_fetch_source_enable_explicit(cli, tmpdir, datafiles):
result.assert_success()
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],)
result.assert_success()
# Assert we checked out both files at their expected location
@@ -164,10 +158,7 @@ def test_submodule_fetch_source_disable(cli, tmpdir, datafiles):
result.assert_success()
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],)
result.assert_success()
# Assert we checked out both files at their expected location
@@ -204,10 +195,7 @@ def test_submodule_fetch_submodule_does_override(cli, tmpdir, datafiles):
result.assert_success()
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],)
result.assert_success()
# Assert we checked out both files at their expected location
@@ -249,10 +237,7 @@ def test_submodule_fetch_submodule_individual_checkout(cli, tmpdir, datafiles):
result.assert_success()
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],)
result.assert_success()
# Assert we checked out files at their expected location
@@ -281,9 +266,7 @@ def test_submodule_fetch_submodule_individual_checkout_explicit(cli, tmpdir, dat
# Add a submodule pointing to the one we created
repo.add_submodule("subdir", "file://" + subrepo.repo, checkout=False)
- ref = repo.add_submodule(
- "othersubdir", "file://" + other_subrepo.repo, checkout=True
- )
+ ref = repo.add_submodule("othersubdir", "file://" + other_subrepo.repo, checkout=True)
# Write out our test target
element = {
@@ -297,10 +280,7 @@ def test_submodule_fetch_submodule_individual_checkout_explicit(cli, tmpdir, dat
result.assert_success()
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],)
result.assert_success()
# Assert we checked out files at their expected location
@@ -335,10 +315,7 @@ def test_submodule_fetch_project_override(cli, tmpdir, datafiles):
result.assert_success()
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir],)
result.assert_success()
# Assert we checked out both files at their expected location
@@ -674,9 +651,7 @@ def test_track_invalid_submodule(cli, tmpdir, datafiles, fail):
@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
@pytest.mark.datafiles(os.path.join(DATA_DIR, "template"))
@pytest.mark.parametrize("ref_format", ["sha1", "git-describe"])
-@pytest.mark.parametrize(
- "tag,extra_commit", [(False, False), (True, False), (True, True)]
-)
+@pytest.mark.parametrize("tag,extra_commit", [(False, False), (True, False), (True, True)])
def test_track_fetch(cli, tmpdir, datafiles, ref_format, tag, extra_commit):
project = str(datafiles)
@@ -781,9 +756,7 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type):
result = cli.run(project=project, args=["source", "track", "target.bst"])
result.assert_success()
else:
- result = cli.run(
- project=project, args=["source", "track", "target.bst", "--deps", "all"]
- )
+ result = cli.run(project=project, args=["source", "track", "target.bst", "--deps", "all"])
result.assert_success()
if ref_storage == "inline":
@@ -805,31 +778,22 @@ def test_git_describe(cli, tmpdir, datafiles, ref_storage, tag_type):
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkout],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkout],)
result.assert_success()
if tag_type == "annotated":
options = []
else:
options = ["--tags"]
- describe = subprocess.check_output(
- ["git", "describe", *options], cwd=checkout, universal_newlines=True
- )
+ describe = subprocess.check_output(["git", "describe", *options], cwd=checkout, universal_newlines=True)
assert describe.startswith("tag2-2-")
describe_fp = subprocess.check_output(
- ["git", "describe", "--first-parent", *options],
- cwd=checkout,
- universal_newlines=True,
+ ["git", "describe", "--first-parent", *options], cwd=checkout, universal_newlines=True,
)
assert describe_fp.startswith("tag1-2-")
- tags = subprocess.check_output(
- ["git", "tag"], cwd=checkout, universal_newlines=True
- )
+ tags = subprocess.check_output(["git", "tag"], cwd=checkout, universal_newlines=True)
tags = set(tags.splitlines())
assert tags == set(["tag1", "tag2"])
@@ -901,9 +865,7 @@ def test_git_describe_head_is_tagged(cli, tmpdir, datafiles, ref_storage, tag_ty
result = cli.run(project=project, args=["source", "track", "target.bst"])
result.assert_success()
else:
- result = cli.run(
- project=project, args=["source", "track", "target.bst", "--deps", "all"]
- )
+ result = cli.run(project=project, args=["source", "track", "target.bst", "--deps", "all"])
result.assert_success()
if ref_storage == "inline":
@@ -926,30 +888,21 @@ def test_git_describe_head_is_tagged(cli, tmpdir, datafiles, ref_storage, tag_ty
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkout],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkout],)
result.assert_success()
if tag_type == "annotated":
options = []
else:
options = ["--tags"]
- describe = subprocess.check_output(
- ["git", "describe", *options], cwd=checkout, universal_newlines=True
- )
+ describe = subprocess.check_output(["git", "describe", *options], cwd=checkout, universal_newlines=True)
assert describe.startswith("tag")
- tags = subprocess.check_output(
- ["git", "tag"], cwd=checkout, universal_newlines=True
- )
+ tags = subprocess.check_output(["git", "tag"], cwd=checkout, universal_newlines=True)
tags = set(tags.splitlines())
assert tags == set(["tag"])
- rev_list = subprocess.check_output(
- ["git", "rev-list", "--all"], cwd=checkout, universal_newlines=True
- )
+ rev_list = subprocess.check_output(["git", "rev-list", "--all"], cwd=checkout, universal_newlines=True)
assert set(rev_list.splitlines()) == set([tagged_ref])
@@ -1013,29 +966,20 @@ def test_git_describe_relevant_history(cli, tmpdir, datafiles):
element_path = os.path.join(project, "target.bst")
_yaml.roundtrip_dump(element, element_path)
- result = cli.run(
- project=project, args=["source", "track", "target.bst", "--deps", "all"]
- )
+ result = cli.run(project=project, args=["source", "track", "target.bst", "--deps", "all"])
result.assert_success()
checkout = os.path.join(str(tmpdir), "checkout")
result = cli.run(project=project, args=["build", "target.bst"])
result.assert_success()
- result = cli.run(
- project=project,
- args=["artifact", "checkout", "target.bst", "--directory", checkout],
- )
+ result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkout],)
result.assert_success()
- describe = subprocess.check_output(
- ["git", "describe"], cwd=checkout, universal_newlines=True
- )
+ describe = subprocess.check_output(["git", "describe"], cwd=checkout, universal_newlines=True)
assert describe.startswith("tag1-2-")
- rev_list = subprocess.check_output(
- ["git", "rev-list", "--all"], cwd=checkout, universal_newlines=True
- )
+ rev_list = subprocess.check_output(["git", "rev-list", "--all"], cwd=checkout, universal_newlines=True)
assert set(rev_list.splitlines()) == set([head, tagged_ref, branch_boundary])
@@ -1102,9 +1046,7 @@ def test_overwrite_rogue_tag_multiple_remotes(cli, tmpdir, datafiles):
repodir, reponame = os.path.split(repo.repo)
project_config = _yaml.load(os.path.join(project, "project.conf"))
project_config["aliases"] = Node.from_dict({"repo": "http://example.com/"})
- project_config["mirrors"] = [
- {"name": "middle-earth", "aliases": {"repo": ["file://{}/".format(repodir)]}}
- ]
+ project_config["mirrors"] = [{"name": "middle-earth", "aliases": {"repo": ["file://{}/".format(repodir)]}}]
_yaml.roundtrip_dump(project_config, os.path.join(project, "project.conf"))
repo.add_annotated_tag("tag", "tag")