Author: mattip <[email protected]>
Branch: 
Changeset: r83783:fa743228fbdb
Date: 2016-04-20 07:15 +0300
http://bitbucket.org/pypy/pypy/changeset/fa743228fbdb/

Log:    test, fix to not print mandlebrot to log files

diff --git a/rpython/tool/ansi_print.py b/rpython/tool/ansi_print.py
--- a/rpython/tool/ansi_print.py
+++ b/rpython/tool/ansi_print.py
@@ -67,6 +67,8 @@
 
     def dot(self):
         """Output a mandelbrot dot to the terminal."""
+        if not isatty():
+            return
         global wrote_dot
         if not wrote_dot:
             mandelbrot_driver.reset()
diff --git a/rpython/tool/test/test_ansi_print.py 
b/rpython/tool/test/test_ansi_print.py
--- a/rpython/tool/test/test_ansi_print.py
+++ b/rpython/tool/test/test_ansi_print.py
@@ -65,6 +65,19 @@
     assert output[3] == ('[test:WARNING] maybe?\n', (31,))
     assert len(output[4][0]) == 1    # single character
 
+def test_no_tty():
+    log = ansi_print.AnsiLogger('test')
+    with FakeOutput(tty=False) as output:
+        log.dot()
+        log.dot()
+        log.WARNING('oops')
+        log.WARNING('maybe?')
+        log.dot()
+    assert len(output) == 2
+    assert output[0] == ('[test:WARNING] oops\n', ())
+    assert output[1] == ('[test:WARNING] maybe?\n', ())
+        
+
 def test_unknown_method_names():
     log = ansi_print.AnsiLogger('test')
     with FakeOutput() as output:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to