From 7b4411e49ee76ae2f3428e4f3cc5f1d6839469d4 Mon Sep 17 00:00:00 2001 From: Krzysztof Gogolewski Date: Sun, 21 Sep 2014 01:15:33 +0200 Subject: Do not set buffering under Python 3, show a warning with Python 3 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. --- testsuite/driver/runtests.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'testsuite') 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: -- cgit v1.2.1