You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:35:37 UTC
[buildstream] 05/15: workspace.py: Don't use the same directory for
everything
This is an automated email from the ASF dual-hosted git repository.
not-in-ldap pushed a commit to branch bschubert/standardize-source-tests
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit e8280a90b166887a199bd3b4c82a2e836537bcf4
Author: Benjamin Schubert <co...@benschubert.me>
AuthorDate: Fri Oct 9 10:53:24 2020 +0000
workspace.py: Don't use the same directory for everything
---
src/buildstream/testing/_sourcetests/workspace.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/buildstream/testing/_sourcetests/workspace.py b/src/buildstream/testing/_sourcetests/workspace.py
index 40dcb6a..9edd9d9 100644
--- a/src/buildstream/testing/_sourcetests/workspace.py
+++ b/src/buildstream/testing/_sourcetests/workspace.py
@@ -33,7 +33,7 @@ DATA_DIR = os.path.join(TOP_DIR, "project")
@pytest.mark.datafiles(DATA_DIR)
-def test_open(cli, tmpdir, datafiles, kind):
+def test_open(cli, tmpdir_factory, datafiles, kind):
project_path = str(datafiles)
bin_files_path = os.path.join(project_path, "files", "bin-files")
@@ -42,7 +42,7 @@ def test_open(cli, tmpdir, datafiles, kind):
# Create our repo object of the given source type with
# the bin files, and then collect the initial ref.
- repo = create_repo(kind, str(tmpdir))
+ repo = create_repo(kind, str(tmpdir_factory.mktemp("repo-{}".format(kind))))
ref = repo.create(bin_files_path)
# Write out our test target
@@ -52,10 +52,7 @@ def test_open(cli, tmpdir, datafiles, kind):
# Assert that there is no reference, a fetch is needed
assert cli.get_element_state(project_path, element_name) == "fetch needed"
- workspace_cmd = os.path.join(project_path, "workspace_cmd")
- os.makedirs(workspace_cmd, exist_ok=True)
- # remove the '.bst' at the end of the element
- workspace_dir = os.path.join(workspace_cmd, element_name[-4:])
+ workspace_dir = os.path.join(tmpdir_factory.mktemp("opened_workspace"))
# Now open the workspace, this should have the effect of automatically
# fetching the source from the repo.