summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2019-11-06 09:16:18 +0000
committerDarius Makovsky <traveltissues@protonmail.com>2019-11-06 09:16:21 +0000
commit2245af28b79cf978d7eb19fdb06273a4515c62d6 (patch)
tree569e5e1baada26a6d7efc4cdaa0a45ad36bcd9b5 /tests
parent602cf41d04f79dfa2dcae72e690cad3168b7321d (diff)
downloadbuildstream-2245af28b79cf978d7eb19fdb06273a4515c62d6.tar.gz
Remove unnecessary ignore_workspaces kwarg
Attempting to open a workspace for the same element without closing it now raises. This makes this kwarg unnecessary and tests should close workspaces between attempts to open.
Diffstat (limited to 'tests')
-rw-r--r--tests/frontend/workspace.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 43cd6f381..0c7e63525 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -315,6 +315,15 @@ def test_open_track(cli, tmpdir, datafiles):
@pytest.mark.datafiles(DATA_DIR)
+def test_open_noclose_open(cli, tmpdir, datafiles):
+ # opening the same workspace twice without closing it should fail
+ element_name, project, _ = open_workspace(cli, tmpdir, datafiles, 'git')
+
+ result = cli.run(project=project, args=['workspace', 'open', element_name])
+ result.assert_main_error(ErrorDomain.STREAM, None)
+
+
+@pytest.mark.datafiles(DATA_DIR)
def test_open_force(cli, tmpdir, datafiles):
element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, 'git')
@@ -338,6 +347,9 @@ def test_open_force(cli, tmpdir, datafiles):
def test_open_force_open(cli, tmpdir, datafiles):
element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, 'git')
+ result = cli.run(project=project, args=['workspace', 'close', element_name])
+ result.assert_success()
+
# Assert the workspace dir exists
assert os.path.exists(workspace)
@@ -396,18 +408,20 @@ def test_open_force_different_workspace(cli, tmpdir, datafiles):
# Assert that workspace 2 contains the unmodified file
assert os.path.exists(os.path.join(workspace2, 'usr', 'bin', 'hello'))
+ result = cli.run(project=project, args=['workspace', 'close', element_name2])
+ result.assert_success()
+
# Now open the workspace again with --force, this should happily succeed
result = cli.run(project=project, args=[
'workspace', 'open', '--force', '--directory', workspace, element_name2
])
+ result.assert_success()
# Assert that the file in workspace 1 has been replaced
# With the file from workspace 2
assert os.path.exists(hello_path)
assert not os.path.exists(hello1_path)
- result.assert_success()
-
@pytest.mark.datafiles(DATA_DIR)
def test_close(cli, tmpdir, datafiles):