[py-svn] r37034 - py/branch/config/py/misc/testing

fijal at codespeak.net fijal at codespeak.net
Fri Jan 19 18:58:15 CET 2007


Author: fijal
Date: Fri Jan 19 18:58:13 2007
New Revision: 37034

Added:
   py/branch/config/py/misc/testing/test_terminal.py
Log:
Rather stupid test for get_terminal_width


Added: py/branch/config/py/misc/testing/test_terminal.py
==============================================================================
--- (empty file)
+++ py/branch/config/py/misc/testing/test_terminal.py	Fri Jan 19 18:58:13 2007
@@ -0,0 +1,21 @@
+
+import os
+from py.__.misc.terminal_helper import get_terminal_width
+
+def test_terminal_width():
+    """ Dummy test for get_terminal_width
+    """
+    assert get_terminal_width()
+    try:
+        def f(*args):
+            raise ValueError
+        import fcntl
+        ioctl = fcntl.ioctl
+        fcntl.ioctl = f
+        cols = os.environ.get('COLUMNS', None)
+        os.environ['COLUMNS'] = '42'
+        assert get_terminal_width() == 41
+    finally:
+        fcntl.ioctl = ioctl
+        if cols:
+            os.environ['COLUMNS'] = cols



More information about the pytest-commit mailing list