summaryrefslogtreecommitdiff
path: root/tests/frontend/workspace.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-02 20:11:11 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-02 20:11:11 +0900
commitaf71900784bf97fe471336fc1a0f28b9183e5df2 (patch)
tree5dcccbb07d438d07c4546517ae65797b0be2c292 /tests/frontend/workspace.py
parent22c6ef1742500f9354275da5028977eaccbbb094 (diff)
downloadbuildstream-af71900784bf97fe471336fc1a0f28b9183e5df2.tar.gz
tests/frontend/workspace.py: Test that we can remove a workspace for a nonexisting element
Guard against regressions of issue #249
Diffstat (limited to 'tests/frontend/workspace.py')
-rw-r--r--tests/frontend/workspace.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 7d5fd36b0..494b053d5 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -135,6 +135,26 @@ def test_close_removed(cli, tmpdir, datafiles, kind):
@pytest.mark.datafiles(DATA_DIR)
+def test_close_nonexistant_element(cli, tmpdir, datafiles):
+ element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, 'git', False)
+ element_path = os.path.join(datafiles.dirname, datafiles.basename, 'elements', element_name)
+
+ # First brutally remove the element.bst file, ensuring that
+ # the element does not exist anymore in the project where
+ # we want to close the workspace.
+ os.remove(element_path)
+
+ # Close the workspace
+ result = cli.run(project=project, args=[
+ 'workspace', 'close', '--remove-dir', element_name
+ ])
+ result.assert_success()
+
+ # Assert the workspace dir has been deleted
+ assert not os.path.exists(workspace)
+
+
+@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("kind", repo_kinds)
def test_reset(cli, tmpdir, datafiles, kind):
# Open the workspace