[pypy-commit] pypy verbose-imports: Test verbose = 0, too

william_ml_leslie pypy.commits at gmail.com
Tue Apr 26 08:40:48 EDT 2016


Author: William ML Leslie <william.leslie.ttg at gmail.com>
Branch: verbose-imports
Changeset: r83905:64f8ef4f4941
Date: 2016-04-26 22:39 +1000
http://bitbucket.org/pypy/pypy/changeset/64f8ef4f4941/

Log:	Test verbose = 0, too

diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -100,6 +100,7 @@
         'a=15\nb=16\rc="""foo\r\nbar"""\r', mode='wb')
     setuppkg("verbose1pkg", verbosemod='a = 1729')
     setuppkg("verbose2pkg", verbosemod='a = 1729')
+    setuppkg("verbose0pkg", verbosemod='a = 1729')
 
     # create compiled/x.py and a corresponding pyc file
     p = setuppkg("compiled", x = "x = 84")
@@ -761,6 +762,20 @@
         assert output[-2].startswith('# trying')
         assert 'import verbose2pkg.verbosemod # from ' in output[-1]
 
+    def test_verbose_flag_0(self):
+        output = []
+        class StdErr(object):
+            def write(self, line):
+                output.append(line)
+
+        import sys
+        sys.stderr = StdErr()
+        try:
+            import verbose0pkg.verbosemod
+        finally:
+            reload(sys)
+        assert not output
+
 
 class TestAbi:
     def test_abi_tag(self):


More information about the pypy-commit mailing list