diff options
Diffstat (limited to 'tests/integration/artifact.py')
-rw-r--r-- | tests/integration/artifact.py | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/tests/integration/artifact.py b/tests/integration/artifact.py index 67565b803..d66c86ba9 100644 --- a/tests/integration/artifact.py +++ b/tests/integration/artifact.py @@ -45,25 +45,17 @@ DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project",) # Dse this really need a sandbox? @pytest.mark.datafiles(DATA_DIR) -@pytest.mark.skipif( - not HAVE_SANDBOX, reason="Only available with a functioning sandbox" -) +@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox") def test_cache_buildtrees(cli, tmpdir, datafiles): project = str(datafiles) element_name = "autotools/amhello.bst" cwd = str(tmpdir) # Create artifact shares for pull & push testing - with create_artifact_share( - os.path.join(str(tmpdir), "share1") - ) as share1, create_artifact_share( + with create_artifact_share(os.path.join(str(tmpdir), "share1")) as share1, create_artifact_share( os.path.join(str(tmpdir), "share2") - ) as share2, create_artifact_share( - os.path.join(str(tmpdir), "share3") - ) as share3: - cli.configure( - {"artifacts": {"url": share1.repo, "push": True}, "cachedir": str(tmpdir)} - ) + ) as share2, create_artifact_share(os.path.join(str(tmpdir), "share3")) as share3: + cli.configure({"artifacts": {"url": share1.repo, "push": True}, "cachedir": str(tmpdir)}) # Build autotools element with the default behavior of caching buildtrees # only when necessary. The artifact should be successfully pushed to the share1 remote @@ -86,10 +78,7 @@ def test_cache_buildtrees(cli, tmpdir, datafiles): shutil.rmtree(os.path.join(str(tmpdir), "cas")) shutil.rmtree(os.path.join(str(tmpdir), "artifacts")) assert cli.get_element_state(project, element_name) != "cached" - result = cli.run( - project=project, - args=["--pull-buildtrees", "artifact", "pull", element_name], - ) + result = cli.run(project=project, args=["--pull-buildtrees", "artifact", "pull", element_name],) assert element_name in result.get_pulled_elements() with cli.artifact.extract_buildtree(cwd, cwd, artifact_name) as buildtreedir: assert not buildtreedir @@ -109,13 +98,8 @@ def test_cache_buildtrees(cli, tmpdir, datafiles): # Repeat building the artifacts, this time with cache-buildtrees set to # 'always' via the cli, as such the buildtree dir should not be empty - cli.configure( - {"artifacts": {"url": share2.repo, "push": True}, "cachedir": str(tmpdir)} - ) - result = cli.run( - project=project, - args=["--cache-buildtrees", "always", "build", element_name], - ) + cli.configure({"artifacts": {"url": share2.repo, "push": True}, "cachedir": str(tmpdir)}) + result = cli.run(project=project, args=["--cache-buildtrees", "always", "build", element_name],) assert result.exit_code == 0 assert cli.get_element_state(project, element_name) == "cached" assert share2.get_artifact(cli.get_artifact_name(project, "test", element_name)) @@ -130,10 +114,7 @@ def test_cache_buildtrees(cli, tmpdir, datafiles): shutil.rmtree(os.path.join(str(tmpdir), "cas")) shutil.rmtree(os.path.join(str(tmpdir), "artifacts")) assert cli.get_element_state(project, element_name) != "cached" - result = cli.run( - project=project, - args=["--pull-buildtrees", "artifact", "pull", element_name], - ) + result = cli.run(project=project, args=["--pull-buildtrees", "artifact", "pull", element_name],) assert element_name in result.get_pulled_elements() with cli.artifact.extract_buildtree(cwd, cwd, artifact_name) as buildtreedir: assert os.path.isdir(buildtreedir) |