summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krz.gogolewski@gmail.com>2014-09-21 01:15:33 +0200
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>2014-09-21 01:20:06 +0200
commit7b4411e49ee76ae2f3428e4f3cc5f1d6839469d4 (patch)
tree3190996cc936ea56a433d3726dae689b6c6281ee
parent1b8239dd81c9668ecc08082f7b84cef7739dee32 (diff)
downloadhaskell-wip/python3.tar.gz
Do not set buffering under Python 3, show a warning with Python 3wip/python3
I am not happy with this solution; a better way is to use uniformly unicode or bytes in both Pythons, but this seems too disruptive for now.
-rw-r--r--testsuite/driver/runtests.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 00a0b34aec..883bda754e 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -23,6 +23,11 @@ try:
except:
pass
+PYTHON3 = sys.version_info >= (3, 0)
+if PYTHON3:
+ print("*** WARNING: running testsuite using Python 3.\n"
+ "*** Python 3 support is experimental. See Trac #9184.")
+
from testutil import *
from testglobals import *
@@ -253,9 +258,13 @@ t.start_time = time.localtime()
print('Beginning test run at', time.strftime("%c %Z",t.start_time))
-# set stdout to unbuffered (is this the best way to do it?)
sys.stdout.flush()
-sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w", 0)
+if PYTHON3:
+ # in Python 3, we output text, which cannot be unbuffered
+ sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w")
+else:
+ # set stdout to unbuffered (is this the best way to do it?)
+ sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w", 0)
# First collect all the tests to be run
for file in t_files: