diff options
Diffstat (limited to 'src/buildstream/testing/_sourcetests/workspace.py')
-rw-r--r-- | src/buildstream/testing/_sourcetests/workspace.py | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/src/buildstream/testing/_sourcetests/workspace.py b/src/buildstream/testing/_sourcetests/workspace.py index 7cc308006..149723069 100644 --- a/src/buildstream/testing/_sourcetests/workspace.py +++ b/src/buildstream/testing/_sourcetests/workspace.py @@ -49,9 +49,7 @@ class WorkspaceCreator: self.workspace_cmd = os.path.join(self.project_path, "workspace_cmd") - def create_workspace_element( - self, kind, track, suffix="", workspace_dir=None, element_attrs=None - ): + def create_workspace_element(self, kind, track, suffix="", workspace_dir=None, element_attrs=None): element_name = "workspace-test-{}{}.bst".format(kind, suffix) element_path = os.path.join(self.project_path, "elements") if not workspace_dir: @@ -73,9 +71,7 @@ class WorkspaceCreator: _yaml.roundtrip_dump(element, os.path.join(element_path, element_name)) return element_name, element_path, workspace_dir - def create_workspace_elements( - self, kinds, track, suffixs=None, workspace_dir_usr=None, element_attrs=None - ): + def create_workspace_elements(self, kinds, track, suffixs=None, workspace_dir_usr=None, element_attrs=None): element_tuples = [] @@ -92,9 +88,7 @@ class WorkspaceCreator: 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] - ) + 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: @@ -103,18 +97,10 @@ class WorkspaceCreator: return element_tuples def open_workspaces( - self, - kinds, - track, - suffixs=None, - workspace_dir=None, - element_attrs=None, - no_checkout=False, + self, kinds, track, suffixs=None, workspace_dir=None, element_attrs=None, no_checkout=False, ): - element_tuples = self.create_workspace_elements( - kinds, track, suffixs, workspace_dir, element_attrs - ) + element_tuples = self.create_workspace_elements(kinds, track, suffixs, workspace_dir, element_attrs) os.makedirs(self.workspace_cmd, exist_ok=True) # Now open the workspace, this should have the effect of automatically @@ -129,20 +115,14 @@ class WorkspaceCreator: _, workspace_dir = element_tuples[0] args.extend(["--directory", workspace_dir]) - args.extend( - [element_name for element_name, workspace_dir_suffix in element_tuples] - ) - result = self.cli.run( - cwd=self.workspace_cmd, project=self.project_path, args=args - ) + args.extend([element_name for element_name, workspace_dir_suffix in element_tuples]) + result = self.cli.run(cwd=self.workspace_cmd, project=self.project_path, args=args) result.assert_success() if not no_checkout: # 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] - ) + 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 each workspace @@ -166,9 +146,7 @@ def open_workspace( no_checkout=False, ): workspace_object = WorkspaceCreator(cli, tmpdir, datafiles, project_path) - workspaces = workspace_object.open_workspaces( - (kind,), track, (suffix,), workspace_dir, element_attrs, no_checkout - ) + workspaces = workspace_object.open_workspaces((kind,), track, (suffix,), workspace_dir, element_attrs, no_checkout) assert len(workspaces) == 1 element_name, workspace = workspaces[0] return element_name, workspace_object.project_path, workspace |