diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-07-10 11:07:46 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-07-10 20:10:04 -0400 |
commit | 1a72f002521199985431b054efe0709a20310b37 (patch) | |
tree | 22fcd4431b2288073a60c2ad079c1c36569c60d0 | |
parent | 2fd905581081f8584a4993ad655eddb98a2485c2 (diff) | |
download | meson-1a72f002521199985431b054efe0709a20310b37.zip meson-1a72f002521199985431b054efe0709a20310b37.tar.gz meson-1a72f002521199985431b054efe0709a20310b37.tar.bz2 |
mtest: avoid stdout when printing warnings about the lack of things to print
Since people may parse the output of `--list` as a list of tests,
putting logging info in stderr is nicer.
-rw-r--r-- | mesonbuild/mtest.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 313e79b..8975dcd 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -1906,9 +1906,9 @@ class TestHarness: # succeed on an invalid pattern. raise MesonException(f'{arg} test name does not match any test') - def get_tests(self) -> T.List[TestSerialisation]: + def get_tests(self, errorfile: T.Optional[T.IO] = sys.stdout) -> T.List[TestSerialisation]: if not self.tests: - print('No tests defined.') + print('No tests defined.', file=errorfile) return [] tests = [t for t in self.tests if self.test_suitable(t)] @@ -1916,7 +1916,7 @@ class TestHarness: tests = list(self.tests_from_args(tests)) if not tests: - print('No suitable tests defined.') + print('No suitable tests defined.', file=errorfile) return [] return tests @@ -2074,7 +2074,7 @@ class TestHarness: await l.finish(self) def list_tests(th: TestHarness) -> bool: - tests = th.get_tests() + tests = th.get_tests(errorfile=sys.stderr) for t in tests: print(th.get_pretty_suite(t)) return not tests |