summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhillip Smyth <phillip.smyth@codethink.co.uk>2018-09-24 12:06:32 +0100
committerPhillip Smyth <phillip.smyth@codethink.co.uk>2018-09-25 16:21:20 +0100
commit936e4ffc333a3aa93b369bde1ef0a43fb5af4b86 (patch)
treedf7bc7541b26355f2c7ccc9634b33672072d63d1
parentd0cc95485d1d99ea18da58c185f470932e03fa07 (diff)
downloadbuildstream-workspace_list_error_message.tar.gz
Fixed workspace list error messageworkspace_list_error_message
If no workspaces were found, bst workspace would return `[]` This has been changed to a nicer message
-rw-r--r--buildstream/_stream.py3
-rw-r--r--tests/frontend/cross_junction_workspace.py14
2 files changed, 11 insertions, 6 deletions
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index f4661cc2a..70392f5e8 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -641,6 +641,9 @@ class Stream():
}
workspaces.append(workspace_detail)
+ if not workspaces:
+ workspaces = "No workspaces found"
+
_yaml.dump({
'workspaces': workspaces
})
diff --git a/tests/frontend/cross_junction_workspace.py b/tests/frontend/cross_junction_workspace.py
index eb2bc2eb8..bd6823cd8 100644
--- a/tests/frontend/cross_junction_workspace.py
+++ b/tests/frontend/cross_junction_workspace.py
@@ -93,9 +93,10 @@ def test_close_cross_junction(cli, tmpdir):
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert isinstance(loaded.get('workspaces'), list)
- workspaces = loaded['workspaces']
- assert len(workspaces) == 0
+ if not loaded['workspaces'] == "No workspaces found":
+ assert isinstance(loaded.get('workspaces'), list)
+ workspaces = loaded['workspaces']
+ assert len(workspaces) == 0
def test_close_all_cross_junction(cli, tmpdir):
@@ -112,6 +113,7 @@ def test_close_all_cross_junction(cli, tmpdir):
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert isinstance(loaded.get('workspaces'), list)
- workspaces = loaded['workspaces']
- assert len(workspaces) == 0
+ if not loaded['workspaces'] == "No workspaces found":
+ assert isinstance(loaded.get('workspaces'), list)
+ workspaces = loaded['workspaces']
+ assert len(workspaces) == 0