diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-01-02 11:42:17 +0100 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-02-27 15:25:57 -0500 |
| commit | 4526a75e25c8f4e908e6c142cf6658bac0acb5e3 (patch) | |
| tree | 9f672daae763fe35bc90711c88f449dcdadc3bda /mesonbuild/mtest.py | |
| parent | 23a9a25779db59b213a3dd546fb77625ede95841 (diff) | |
| download | meson-4526a75e25c8f4e908e6c142cf6658bac0acb5e3.tar.gz | |
mtest: move `console_mode` property into TestRun class
Move the `console_mode` property into the TestRun Class. This will be
required by a subsequent commit where we start to ignore test results
for parsed interactive tests.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Diffstat (limited to 'mesonbuild/mtest.py')
| -rw-r--r-- | mesonbuild/mtest.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index cd5c5f100..8e490d5ff 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -948,7 +948,8 @@ class TestRun: return super().__new__(TestRun.PROTOCOL_TO_CLASS[test.protocol]) def __init__(self, test: TestSerialisation, test_env: T.Dict[str, str], - name: str, timeout: T.Optional[int], is_parallel: bool, verbose: bool): + name: str, timeout: T.Optional[int], is_parallel: bool, verbose: bool, + interactive: bool): self.res = TestResult.PENDING self.test = test self._num: T.Optional[int] = None @@ -968,6 +969,7 @@ class TestRun: self.junit: T.Optional[et.ElementTree] = None self.is_parallel = is_parallel self.verbose = verbose + self.interactive = interactive self.warnings: T.List[str] = [] def start(self, cmd: T.List[str]) -> None: @@ -983,6 +985,15 @@ class TestRun: return self._num @property + def console_mode(self) -> ConsoleUser: + if self.interactive: + return ConsoleUser.INTERACTIVE + elif self.direct_stdout: + return ConsoleUser.STDOUT + else: + return ConsoleUser.LOGGER + + @property def direct_stdout(self) -> bool: return self.verbose and not self.is_parallel and not self.needs_parsing @@ -1474,14 +1485,11 @@ class SingleTestRunner: is_parallel = test.is_parallel and self.options.num_processes > 1 and not self.options.interactive verbose = (test.verbose or self.options.verbose) and not self.options.quiet - self.runobj = TestRun(test, env, name, timeout, is_parallel, verbose) + self.runobj = TestRun(test, env, name, timeout, is_parallel, verbose, self.options.interactive) - if self.options.interactive: - self.console_mode = ConsoleUser.INTERACTIVE - elif self.runobj.direct_stdout: - self.console_mode = ConsoleUser.STDOUT - else: - self.console_mode = ConsoleUser.LOGGER + @property + def console_mode(self) -> ConsoleUser: + return self.runobj.console_mode def _get_test_cmd(self) -> T.Optional[T.List[str]]: testentry = self.test.fname[0] |
