summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-09-15 12:31:59 -0700
committerGitHub <noreply@github.com>2021-09-15 21:31:59 +0200
commit17000b5a80e6ec071ea5007dcc6792e9daaaf0f2 (patch)
tree20a3b3f1e91f335e88776cdb8fe67ba5fffe372b /Lib/test
parentbbaf5c27e659cf372c34a6fe7ca31a2f5cb20a50 (diff)
downloadcpython-git-17000b5a80e6ec071ea5007dcc6792e9daaaf0f2.tar.gz
bpo-45205: Make test_compileall quiet (GH-28356) (GH-28370)
Make test_compileall quiet: test_year_2038_mtime_compilation() and test_larger_than_32_bit_times() of test_compileall no longer log "Compiling ..." messages to stdout. (cherry picked from commit cc057ff5227b3a4ded637caa7ba51b67b06abaaa) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_compileall.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py
index cc51b8c06a..9e15ecf3aa 100644
--- a/Lib/test/test_compileall.py
+++ b/Lib/test/test_compileall.py
@@ -91,7 +91,8 @@ class CompileallTestsBase:
os.utime(self.source_path, (2**32 - 1, 2**32 - 1))
except (OverflowError, OSError):
self.skipTest("filesystem doesn't support timestamps near 2**32")
- self.assertTrue(compileall.compile_file(self.source_path))
+ with contextlib.redirect_stdout(io.StringIO()):
+ self.assertTrue(compileall.compile_file(self.source_path))
def test_larger_than_32_bit_times(self):
# This is similar to the test above but we skip it if the OS doesn't
@@ -100,7 +101,8 @@ class CompileallTestsBase:
os.utime(self.source_path, (2**35, 2**35))
except (OverflowError, OSError):
self.skipTest("filesystem doesn't support large timestamps")
- self.assertTrue(compileall.compile_file(self.source_path))
+ with contextlib.redirect_stdout(io.StringIO()):
+ self.assertTrue(compileall.compile_file(self.source_path))
def recreation_check(self, metadata):
"""Check that compileall recreates bytecode when the new metadata is