summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorJoannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>2019-05-28 16:29:04 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2019-05-28 16:29:04 (GMT)
commit2e33ecd7c9b0cac3efc6fcbdd4547fd086b4e2d1 (patch)
treeb87106cad890030018bdefd2ca42092b58ed1330 /Lib/test
parent3c8724fc60163f4f3c3b0d531c84cc7b36783f82 (diff)
downloadcpython-2e33ecd7c9b0cac3efc6fcbdd4547fd086b4e2d1.zip
cpython-2e33ecd7c9b0cac3efc6fcbdd4547fd086b4e2d1.tar.gz
cpython-2e33ecd7c9b0cac3efc6fcbdd4547fd086b4e2d1.tar.bz2
bpo-22640: Add silent mode to py_compile.compile() (GH-12976)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_py_compile.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
index f86abe2..d6677ab 100644
--- a/Lib/test/test_py_compile.py
+++ b/Lib/test/test_py_compile.py
@@ -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,