]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-114075: Capture `test_compileall` stdout output (#114076)
authorKirill Podoprigora <kirill.bast9@mail.ru>
Mon, 15 Jan 2024 10:21:34 +0000 (13:21 +0300)
committerGitHub <noreply@github.com>
Mon, 15 Jan 2024 10:21:34 +0000 (10:21 +0000)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Lib/test/test_compileall.py

index 83a9532aecfac80027867a14d738f54aea752070..0ec6013dc11e3e6b86f0cd3015f4294cf7458ab7 100644 (file)
@@ -369,7 +369,9 @@ class CompileallTestsBase:
         script = script_helper.make_script(path, "test", "1 / 0")
         bc = importlib.util.cache_from_source(script)
         stripdir = os.path.join(self.directory, *(fullpath[:2] + ['fake']))
-        compileall.compile_dir(path, quiet=True, stripdir=stripdir)
+        with support.captured_stdout() as out:
+            compileall.compile_dir(path, quiet=True, stripdir=stripdir)
+        self.assertIn("not a valid prefix", out.getvalue())
         rc, out, err = script_helper.assert_python_failure(bc)
         expected_not_in = os.path.join(self.directory, *fullpath[2:])
         self.assertIn(