diff options
-rw-r--r-- | tox/_cmdline.py | 16 | ||||
-rw-r--r-- | tox/_config.py | 3 |
2 files changed, 10 insertions, 9 deletions
diff --git a/tox/_cmdline.py b/tox/_cmdline.py index 1c25f48..c9e1aa9 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -80,21 +80,20 @@ class Action(object): return f def popen(self, args, cwd=None, env=None, redirect=True, returnout=False): - logged_command = "%s$ %s" %(cwd, " ".join(map(str, args))) stdout = outpath = None resultjson = self.session.config.option.resultjson - resulttee = self.session.config.option.resulttee if resultjson or redirect: f = self._initlogpath(self.id) f.write("actionid=%s\nmsg=%s\ncmdargs=%r\nenv=%s\n" %( self.id, self.msg, args, env)) f.flush() self.popen_outpath = outpath = py.path.local(f.name) - stdout = f + if resultjson: + stdout = subprocess.PIPE + else: + stdout = f elif returnout: stdout = subprocess.PIPE - if resultjson and resulttee: - stdout = subprocess.PIPE if cwd is None: # XXX cwd = self.session.config.cwd cwd = py.path.local() @@ -113,15 +112,20 @@ class Action(object): try: self.report.logpopen(popen, env=env) try: - if resultjson and resulttee: + if resultjson and not redirect: assert popen.stderr is None # prevent deadlock out = None last_time = time.time() while 1: + # we have to read one byte at a time, otherwise there + # might be no output for a long time with slow tests data = popen.stdout.read(1) if data: sys.stdout.write(data) if '\n' in data or (time.time() - last_time) > 5: + # we flush on newlines or after 5 seconds to + # provide quick enough feedback to the user + # when printing a dot per test sys.stdout.flush() last_time = time.time() f.write(data) diff --git a/tox/_config.py b/tox/_config.py index 6a1f2c6..41f02ec 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -117,9 +117,6 @@ def prepare_parse(pkgname): "all commands and results involved. This will turn off " "pass-through output from running test commands which is " "instead captured into the json result file.") - parser.add_argument("--result-tee", action="store_true", - dest="resulttee", - help="echo output of --result-json to stdout while it is captured.") # We choose 1 to 4294967295 because it is the range of PYTHONHASHSEED. parser.add_argument("--hashseed", action="store", metavar="SEED", default=None, |