summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-06-11 14:51:25 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-06-18 09:45:00 +0000
commitd139abbc8cb322ab1249b4ae7b23f86e20d4eb93 (patch)
tree5195073968340b24a2fe11644912555e9271e984
parente55a89bffad51955c6c245eac5df98d025b586b9 (diff)
downloadbuildstream-d139abbc8cb322ab1249b4ae7b23f86e20d4eb93.tar.gz
CliIntegration: match methods to base class
Update 'run' to match the base class. This ensures that it is a fully substitutable sub-class. Introduce 'run_project_config' to allow explicit usage of extended functionality, which wouldn't necessarily be supported by a different subclass. By making the signatures deliberately match, we can use PyLint to ensure the signatures don't accidentally differ. Since we're already relying on `kwargs['project']` succeeding, enforce that run_project_config() only takes keyword arguments.
-rw-r--r--src/buildstream/testing/runcli.py14
-rw-r--r--tests/integration/build-uid.py6
-rw-r--r--tests/integration/shell.py6
3 files changed, 20 insertions, 6 deletions
diff --git a/src/buildstream/testing/runcli.py b/src/buildstream/testing/runcli.py
index 8b3185143..9efff4593 100644
--- a/src/buildstream/testing/runcli.py
+++ b/src/buildstream/testing/runcli.py
@@ -513,6 +513,16 @@ class CliIntegration(Cli):
# run()
#
+ # This supports the same arguments as Cli.run(), see run_project_config().
+ #
+ def run(self, configure=True, project=None, silent=False, env=None,
+ cwd=None, options=None, args=None, binary_capture=False):
+ return self.run_project_config(
+ configure=configure, project=project, silent=silent, env=env,
+ cwd=cwd, options=options, args=args, binary_capture=binary_capture)
+
+ # run_project_config()
+ #
# This supports the same arguments as Cli.run() and additionally
# it supports the project_config keyword argument.
#
@@ -524,7 +534,7 @@ class CliIntegration(Cli):
# be a dictionary of additional project configuration options, and
# will be composited on top of the already loaded project.conf
#
- def run(self, *args, project_config=None, **kwargs):
+ def run_project_config(self, *, project_config=None, **kwargs):
# First load the project.conf and substitute {project_dir}
#
@@ -575,7 +585,7 @@ class CliIntegration(Cli):
with open(project_filename, 'w') as f:
f.write(config)
- return super().run(*args, **kwargs)
+ return super().run(**kwargs)
class CliRemote(CliIntegration):
diff --git a/tests/integration/build-uid.py b/tests/integration/build-uid.py
index 2ebf230a1..26f1bd2d4 100644
--- a/tests/integration/build-uid.py
+++ b/tests/integration/build-uid.py
@@ -30,7 +30,8 @@ def test_build_uid_overridden(cli, datafiles):
}
}
- result = cli.run(project=project, project_config=project_config, args=['build', element_name])
+ result = cli.run_project_config(
+ project=project, project_config=project_config, args=['build', element_name])
assert result.exit_code == 0
@@ -48,7 +49,8 @@ def test_build_uid_in_project(cli, datafiles):
}
}
- result = cli.run(project=project, project_config=project_config, args=['build', element_name])
+ result = cli.run_project_config(
+ project=project, project_config=project_config, args=['build', element_name])
assert result.exit_code == 0
diff --git a/tests/integration/shell.py b/tests/integration/shell.py
index 868064d5b..d0c9f1f99 100644
--- a/tests/integration/shell.py
+++ b/tests/integration/shell.py
@@ -33,7 +33,8 @@ DATA_DIR = os.path.join(
#
def execute_shell(cli, project, command, *, config=None, mount=None, element='base.bst', isolate=False):
# Ensure the element is built
- result = cli.run(project=project, project_config=config, args=['build', element])
+ result = cli.run_project_config(
+ project=project, project_config=config, args=['build', element])
assert result.exit_code == 0
args = ['shell']
@@ -44,7 +45,8 @@ def execute_shell(cli, project, command, *, config=None, mount=None, element='ba
args += ['--mount', host_path, target_path]
args += [element, '--', *command]
- return cli.run(project=project, project_config=config, args=args)
+ return cli.run_project_config(
+ project=project, project_config=config, args=args)
# Test running something through a shell, allowing it to find the