Executes the test runner with captured output.
(
self, *args, baseroot='testroot1', config_overrides=None,
with_build_config=True, outdir='out', **kwargs)
| 194 | pool.setup_testing() |
| 195 | |
| 196 | def run_tests( |
| 197 | self, *args, baseroot='testroot1', config_overrides=None, |
| 198 | with_build_config=True, outdir='out', **kwargs): |
| 199 | """Executes the test runner with captured output.""" |
| 200 | with temp_base(baseroot=baseroot) as basedir: |
| 201 | if with_build_config: |
| 202 | setup_build_config(basedir, outdir) |
| 203 | override_build_config(basedir, **(config_overrides or {})) |
| 204 | json_out_path = None |
| 205 | def resolve_arg(arg): |
| 206 | """Some arguments come as function objects to be called (resolved) |
| 207 | in the context of a temporary test configuration""" |
| 208 | nonlocal json_out_path |
| 209 | if arg == with_json_output: |
| 210 | json_out_path = with_json_output(basedir) |
| 211 | return json_out_path |
| 212 | return arg |
| 213 | resolved_args = [resolve_arg(arg) for arg in args] |
| 214 | with capture() as (stdout, stderr): |
| 215 | sys_args = ['--command-prefix', sys.executable] + resolved_args |
| 216 | if kwargs.get('infra_staging', False): |
| 217 | sys_args.append('--infra-staging') |
| 218 | else: |
| 219 | sys_args.append('--no-infra-staging') |
| 220 | runner = self.get_runner_class()(basedir=basedir) |
| 221 | code = runner.execute(sys_args) |
| 222 | json_out = clean_json_output(json_out_path, basedir) |
| 223 | test_schedule = test_schedule_log(json_out_path) |
| 224 | return TestResult( |
| 225 | stdout.getvalue(), stderr.getvalue(), code, json_out, test_schedule, self) |
| 226 | |
| 227 | def get_runner_options(self, baseroot='testroot1'): |
| 228 | """Returns a list of all flags parsed by the test runner.""" |
no test coverage detected