From 7911aed366660c73c2d348d31e1657ed73372540 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Sat, 15 Dec 2012 16:51:47 +0300 Subject: runtest.py: Turn on unbuffered output ASAP. --- runtest.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/runtest.py b/runtest.py index d6af07e..e482dc6 100644 --- a/runtest.py +++ b/runtest.py @@ -289,6 +289,23 @@ runtest.py: No tests were specified. """) sys.exit(1) + +# --- setup stdout/stderr --- +class Unbuffered(object): + def __init__(self, file): + self.file = file + self.softspace = 0 ## backward compatibility; not supported in Py3k + def write(self, arg): + self.file.write(arg) + self.file.flush() + def __getattr__(self, attr): + return getattr(self.file, attr) + +sys.stdout = Unbuffered(sys.stdout) +sys.stderr = Unbuffered(sys.stderr) + + +# --- define helpers ---- if sys.platform in ('win32', 'cygwin'): def whereis(file): @@ -488,6 +505,7 @@ format_class = { Test = format_class[format] +# --- start processing --- if package: dir = { @@ -746,19 +764,6 @@ if qmtest: tests = [Test(t) for t in tests] -class Unbuffered(object): - def __init__(self, file): - self.file = file - self.softspace = 0 ## backward compatibility; not supported in Py3k - def write(self, arg): - self.file.write(arg) - self.file.flush() - def __getattr__(self, attr): - return getattr(self.file, attr) - -sys.stdout = Unbuffered(sys.stdout) -sys.stderr = Unbuffered(sys.stderr) - if list_only: for t in tests: sys.stdout.write(t.path + "\n") -- cgit v0.12