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:55:23 UTC
[buildstream] 09/09: Fixed workspace list error message
This is an automated email from the ASF dual-hosted git repository.
not-in-ldap pushed a commit to branch workspace_list_error_message
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 936e4ffc333a3aa93b369bde1ef0a43fb5af4b86
Author: Phillip Smyth <ph...@codethink.co.uk>
AuthorDate: Mon Sep 24 12:06:32 2018 +0100
Fixed workspace list error message
If no workspaces were found, bst workspace would return `[]`
This has been changed to a nicer message
---
buildstream/_stream.py | 3 +++
tests/frontend/cross_junction_workspace.py | 14 ++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index f4661cc..70392f5 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 eb2bc2e..bd6823c 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