You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/01/13 12:31:33 UTC

[buildstream] 02/02: tests/frontend/artifact_checkout.py: Test artifact checkout without project

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/optional-project
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit e658aa575a1ea6aa59897e805380082606f3a699
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Wed Jan 13 21:24:37 2021 +0900

    tests/frontend/artifact_checkout.py: Test artifact checkout without project
    
    Test that we can operate on artifact refs without the need to have a
    project.conf present locally.
---
 tests/frontend/artifact_checkout.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/frontend/artifact_checkout.py b/tests/frontend/artifact_checkout.py
index 18c63a2..1375bc3 100644
--- a/tests/frontend/artifact_checkout.py
+++ b/tests/frontend/artifact_checkout.py
@@ -32,7 +32,8 @@ DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project")
     ],
     ids=["none", "build", "run", "all"],
 )
-def test_checkout(cli, tmpdir, datafiles, deps, expect_exist, expect_noexist):
+@pytest.mark.parametrize("with_project", [True, False], ids=["with-project", "without-project"])
+def test_checkout(cli, tmpdir, datafiles, deps, expect_exist, expect_noexist, with_project):
     project = str(datafiles)
     checkout = os.path.join(cli.directory, "checkout")
 
@@ -56,7 +57,11 @@ def test_checkout(cli, tmpdir, datafiles, deps, expect_exist, expect_noexist):
         shutil.rmtree(str(os.path.join(str(tmpdir), "cache", "artifacts")))
         assert cli.get_element_state(project, "target-import.bst") != "cached"
 
-        # Now checkout the artifacy
+        # Delete the project.conf if we're going to try this without a project
+        if not with_project:
+            os.remove(os.path.join(project, "project.conf"))
+
+        # Now checkout the artifact
         result = cli.run(
             project=project,
             args=["artifact", "checkout", "--directory", checkout, "--pull", "--deps", deps, artifact_name],