https://github.com/python/cpython/commit/892155d7365c9c4a6c2dd6850b4527222ba5c217
commit: 892155d7365c9c4a6c2dd6850b4527222ba5c217
branch: main
author: Kirill Podoprigora <[email protected]>
committer: AlexWaygood <[email protected]>
date: 2024-01-15T10:21:34Z
summary:

gh-114075: Capture `test_compileall` stdout output  (#114076)

Co-authored-by: Alex Waygood <[email protected]>

files:
M Lib/test/test_compileall.py

diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py
index 83a9532aecfac8..0ec6013dc11e3e 100644
--- a/Lib/test/test_compileall.py
+++ b/Lib/test/test_compileall.py
@@ -369,7 +369,9 @@ def test_strip_only_invalid(self):
         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(

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to