Skip to content

Commit 892155d

Browse files
Eclips4AlexWaygood
andauthored
gh-114075: Capture test_compileall stdout output (#114076)
Co-authored-by: Alex Waygood <[email protected]>
1 parent f8a7910 commit 892155d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_compileall.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,9 @@ def test_strip_only_invalid(self):
369369
script = script_helper.make_script(path, "test", "1 / 0")
370370
bc = importlib.util.cache_from_source(script)
371371
stripdir = os.path.join(self.directory, *(fullpath[:2] + ['fake']))
372-
compileall.compile_dir(path, quiet=True, stripdir=stripdir)
372+
with support.captured_stdout() as out:
373+
compileall.compile_dir(path, quiet=True, stripdir=stripdir)
374+
self.assertIn("not a valid prefix", out.getvalue())
373375
rc, out, err = script_helper.assert_python_failure(bc)
374376
expected_not_in = os.path.join(self.directory, *fullpath[2:])
375377
self.assertIn(

0 commit comments

Comments
 (0)