summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-24 00:01:24 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-24 00:01:56 -0500
commit46eb301831f205abbee7408c0e37df92b0991ac5 (patch)
tree30e51257047370c2ebe2b0ec0b6947a239022587
parent83fcaa9f7d55f017c64c02bef5a47d1e455340ec (diff)
downloadbuildstream-46eb301831f205abbee7408c0e37df92b0991ac5.tar.gz
tests/frontend/workspace.py: Refactored to use get_element_states()
-rw-r--r--tests/frontend/workspace.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index d08225353..d73bb1c70 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -107,15 +107,17 @@ class WorkspaceCreater():
element_name, element_path, workspace_dir = \
self.create_workspace_element(kind, track, suffix, workspace_dir_usr,
element_attrs)
-
- # Assert that there is no reference, a track & fetch is needed
- state = self.cli.get_element_state(self.project_path, element_name)
- if track:
- assert state == 'no reference'
- else:
- assert state == 'fetch needed'
element_tuples.append((element_name, workspace_dir))
+ # Assert that there is no reference, a track & fetch is needed
+ states = self.cli.get_element_states(self.project_path, [
+ e for e, _ in element_tuples
+ ])
+ if track:
+ assert not any(states[e] != 'no reference' for e, _ in element_tuples)
+ else:
+ assert not any(states[e] != 'fetch needed' for e, _ in element_tuples)
+
return element_tuples
def open_workspaces(self, kinds, track, suffixs=None, workspace_dir=None,
@@ -140,12 +142,14 @@ class WorkspaceCreater():
result.assert_success()
- for element_name, workspace_dir in element_tuples:
- # Assert that we are now buildable because the source is
- # now cached.
- assert self.cli.get_element_state(self.project_path, element_name) == 'buildable'
+ # Assert that we are now buildable because the source is now cached.
+ states = self.cli.get_element_states(self.project_path, [
+ e for e, _ in element_tuples
+ ])
+ assert not any(states[e] != 'buildable' for e, _ in element_tuples)
- # Check that the executable hello file is found in the workspace
+ # Check that the executable hello file is found in each workspace
+ for element_name, workspace_dir in element_tuples:
filename = os.path.join(workspace_dir, 'usr', 'bin', 'hello')
assert os.path.exists(filename)