mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-22640: Add silent mode to py_compile.compile() (GH-12976)
This commit is contained in:
parent
3c8724fc60
commit
2e33ecd7c9
5 changed files with 43 additions and 9 deletions
|
@ -192,6 +192,15 @@ class PyCompileTestsBase:
|
|||
fp.read(), 'test', {})
|
||||
self.assertEqual(flags, 0b1)
|
||||
|
||||
def test_quiet(self):
|
||||
bad_coding = os.path.join(os.path.dirname(__file__), 'bad_coding2.py')
|
||||
with support.captured_stderr() as stderr:
|
||||
self.assertIsNone(py_compile.compile(bad_coding, doraise=False, quiet=2))
|
||||
self.assertIsNone(py_compile.compile(bad_coding, doraise=True, quiet=2))
|
||||
self.assertEqual(stderr.getvalue(), '')
|
||||
with self.assertRaises(py_compile.PyCompileError):
|
||||
py_compile.compile(bad_coding, doraise=True, quiet=1)
|
||||
|
||||
|
||||
class PyCompileTestsWithSourceEpoch(PyCompileTestsBase,
|
||||
unittest.TestCase,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue