summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin David <valentin.david@codethink.co.uk>2018-08-23 18:44:15 +0200
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-24 06:48:08 +0000
commitd88568ef71d309858ffb9093fb4c590f40fc7921 (patch)
tree5c565bd296c94b8d9438cff8a721659d446d9ff7
parent86e4729d66f198ff1713b54f8bc0fadb1eb4e0fa (diff)
downloadbuildstream-valentindavid/cli_integration_source_determinism.tar.gz
tests/integration/source-determinism.py: Use cli_integration.valentindavid/cli_integration_source_determinism
-rw-r--r--tests/integration/source-determinism.py15
-rw-r--r--tests/testutils/runcli.py6
2 files changed, 14 insertions, 7 deletions
diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py
index b60bc25f7..d1760c267 100644
--- a/tests/integration/source-determinism.py
+++ b/tests/integration/source-determinism.py
@@ -2,7 +2,8 @@ import os
import pytest
from buildstream import _yaml, utils
-from tests.testutils import cli, create_repo, ALL_REPO_KINDS
+from tests.testutils import create_repo, ALL_REPO_KINDS
+from tests.testutils import cli_integration as cli
DATA_DIR = os.path.join(
@@ -28,7 +29,7 @@ def create_test_directory(*path, mode=0o644):
@pytest.mark.integration
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS] + ['local'])
-def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
+def test_deterministic_source_umask(cli, tmpdir, datafiles, kind, integration_cache):
project = str(datafiles)
element_name = 'list'
element_path = os.path.join(project, 'elements', element_name)
@@ -91,14 +92,16 @@ def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
return f.read()
finally:
os.umask(old_umask)
- cli.remove_artifact_from_cache(project, element_name)
+ cache_dir = os.path.join(integration_cache, 'artifacts')
+ cli.remove_artifact_from_cache(project, element_name,
+ cache_dir=cache_dir)
assert get_value_for_umask(0o022) == get_value_for_umask(0o077)
@pytest.mark.integration
@pytest.mark.datafiles(DATA_DIR)
-def test_deterministic_source_local(cli, tmpdir, datafiles):
+def test_deterministic_source_local(cli, tmpdir, datafiles, integration_cache):
"""Only user rights should be considered for local source.
"""
project = str(datafiles)
@@ -150,6 +153,8 @@ def test_deterministic_source_local(cli, tmpdir, datafiles):
with open(os.path.join(checkoutdir, 'ls-l'), 'r') as f:
return f.read()
finally:
- cli.remove_artifact_from_cache(project, element_name)
+ cache_dir = os.path.join(integration_cache, 'artifacts')
+ cli.remove_artifact_from_cache(project, element_name,
+ cache_dir=cache_dir)
assert get_value_for_mask(0o7777) == get_value_for_mask(0o0700)
diff --git a/tests/testutils/runcli.py b/tests/testutils/runcli.py
index 96d4ea457..ee4eb957e 100644
--- a/tests/testutils/runcli.py
+++ b/tests/testutils/runcli.py
@@ -198,8 +198,10 @@ class Cli():
for key, val in config.items():
self.config[key] = val
- def remove_artifact_from_cache(self, project, element_name):
- cache_dir = os.path.join(project, 'cache', 'artifacts')
+ def remove_artifact_from_cache(self, project, element_name,
+ *, cache_dir=None):
+ if not cache_dir:
+ cache_dir = os.path.join(project, 'cache', 'artifacts')
cache_dir = os.path.join(cache_dir, 'cas', 'refs', 'heads')