summaryrefslogtreecommitdiff
path: root/tests/integration/script.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/script.py')
-rw-r--r--tests/integration/script.py101
1 files changed, 18 insertions, 83 deletions
diff --git a/tests/integration/script.py b/tests/integration/script.py
index 4f44feae4..964cab384 100644
--- a/tests/integration/script.py
+++ b/tests/integration/script.py
@@ -33,9 +33,7 @@ def create_script_element(name, path, config=None, variables=None):
@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_script(cli, datafiles):
project = str(datafiles)
checkout = os.path.join(cli.directory, "checkout")
@@ -45,21 +43,13 @@ def test_script(cli, datafiles):
create_script_element(
element_name,
element_path,
- config={
- "commands": [
- "mkdir -p %{install-root}",
- "echo 'Hi' > %{install-root}/test",
- ],
- },
+ config={"commands": ["mkdir -p %{install-root}", "echo 'Hi' > %{install-root}/test",],},
)
res = cli.run(project=project, args=["build", element_name])
assert res.exit_code == 0
- res = cli.run(
- project=project,
- args=["artifact", "checkout", element_name, "--directory", checkout],
- )
+ res = cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout],)
assert res.exit_code == 0
with open(os.path.join(checkout, "test")) as f:
@@ -69,9 +59,7 @@ def test_script(cli, datafiles):
@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_script_root(cli, datafiles):
project = str(datafiles)
checkout = os.path.join(cli.directory, "checkout")
@@ -96,10 +84,7 @@ def test_script_root(cli, datafiles):
res = cli.run(project=project, args=["build", element_name])
assert res.exit_code == 0
- res = cli.run(
- project=project,
- args=["artifact", "checkout", element_name, "--directory", checkout],
- )
+ res = cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout],)
assert res.exit_code == 0
with open(os.path.join(checkout, "test")) as f:
@@ -109,9 +94,7 @@ def test_script_root(cli, datafiles):
@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")
@pytest.mark.xfail(HAVE_SANDBOX == "buildbox", reason="Not working with BuildBox")
def test_script_no_root(cli, datafiles):
project = str(datafiles)
@@ -138,9 +121,7 @@ def test_script_no_root(cli, datafiles):
@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")
@pytest.mark.xfail(HAVE_SANDBOX == "buildbox", reason="Not working with BuildBox")
def test_script_cwd(cli, datafiles):
project = str(datafiles)
@@ -151,19 +132,14 @@ def test_script_cwd(cli, datafiles):
create_script_element(
element_name,
element_path,
- config={
- "commands": ["echo 'test' > test", "cp /buildstream/test %{install-root}"],
- },
+ config={"commands": ["echo 'test' > test", "cp /buildstream/test %{install-root}"],},
variables={"cwd": "/buildstream"},
)
res = cli.run(project=project, args=["build", element_name])
assert res.exit_code == 0
- res = cli.run(
- project=project,
- args=["artifact", "checkout", element_name, "--directory", checkout],
- )
+ res = cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout],)
assert res.exit_code == 0
with open(os.path.join(checkout, "test")) as f:
@@ -173,9 +149,7 @@ def test_script_cwd(cli, datafiles):
@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_script_layout(cli, datafiles):
project = str(datafiles)
checkout = os.path.join(cli.directory, "checkout")
@@ -185,8 +159,7 @@ def test_script_layout(cli, datafiles):
assert res.exit_code == 0
cli.run(
- project=project,
- args=["artifact", "checkout", element_name, "--directory", checkout],
+ project=project, args=["artifact", "checkout", element_name, "--directory", checkout],
)
assert res.exit_code == 0
@@ -197,9 +170,7 @@ def test_script_layout(cli, datafiles):
@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_regression_cache_corruption(cli, datafiles):
project = str(datafiles)
checkout_original = os.path.join(cli.directory, "checkout-original")
@@ -211,14 +182,7 @@ def test_regression_cache_corruption(cli, datafiles):
assert res.exit_code == 0
res = cli.run(
- project=project,
- args=[
- "artifact",
- "checkout",
- canary_element_name,
- "--directory",
- checkout_original,
- ],
+ project=project, args=["artifact", "checkout", canary_element_name, "--directory", checkout_original,],
)
assert res.exit_code == 0
@@ -228,16 +192,7 @@ def test_regression_cache_corruption(cli, datafiles):
res = cli.run(project=project, args=["build", element_name])
assert res.exit_code == 0
- res = cli.run(
- project=project,
- args=[
- "artifact",
- "checkout",
- canary_element_name,
- "--directory",
- checkout_after,
- ],
- )
+ res = cli.run(project=project, args=["artifact", "checkout", canary_element_name, "--directory", checkout_after,],)
assert res.exit_code == 0
with open(os.path.join(checkout_after, "canary")) as f:
@@ -245,9 +200,7 @@ def test_regression_cache_corruption(cli, datafiles):
@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_regression_tmpdir(cli, datafiles):
project = str(datafiles)
element_name = "script/tmpdir.bst"
@@ -257,9 +210,7 @@ def test_regression_tmpdir(cli, datafiles):
@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_regression_cache_corruption_2(cli, datafiles):
project = str(datafiles)
checkout_original = os.path.join(cli.directory, "checkout-original")
@@ -271,14 +222,7 @@ def test_regression_cache_corruption_2(cli, datafiles):
assert res.exit_code == 0
res = cli.run(
- project=project,
- args=[
- "artifact",
- "checkout",
- canary_element_name,
- "--directory",
- checkout_original,
- ],
+ project=project, args=["artifact", "checkout", canary_element_name, "--directory", checkout_original,],
)
assert res.exit_code == 0
@@ -288,16 +232,7 @@ def test_regression_cache_corruption_2(cli, datafiles):
res = cli.run(project=project, args=["build", element_name])
assert res.exit_code == 0
- res = cli.run(
- project=project,
- args=[
- "artifact",
- "checkout",
- canary_element_name,
- "--directory",
- checkout_after,
- ],
- )
+ res = cli.run(project=project, args=["artifact", "checkout", canary_element_name, "--directory", checkout_after,],)
assert res.exit_code == 0
with open(os.path.join(checkout_after, "canary")) as f: