summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranatoly techtonik <techtonik@gmail.com>2012-12-15 16:51:47 +0300
committeranatoly techtonik <techtonik@gmail.com>2012-12-15 16:51:47 +0300
commit7911aed366660c73c2d348d31e1657ed73372540 (patch)
tree290d09b5aec0bc8bb05e1c68dc51a1a5cee38390
parentcab504dd1de67c0eaeb8f7f4553826937303a3e6 (diff)
downloadscons-git-7911aed366660c73c2d348d31e1657ed73372540.tar.gz
runtest.py: Turn on unbuffered output ASAP.
-rw-r--r--runtest.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/runtest.py b/runtest.py
index d6af07ecf..e482dc698 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")