Author: Ronny Pfannschmidt <ronny.pfannschm...@gmx.de> Branch: refine-testrunner Changeset: r61663:0417a7978d7d Date: 2013-02-23 13:28 +0100 http://bitbucket.org/pypy/pypy/changeset/0417a7978d7d/
Log: shuffle opening the log output around diff --git a/testrunner/runner.py b/testrunner/runner.py --- a/testrunner/runner.py +++ b/testrunner/runner.py @@ -33,7 +33,8 @@ def execute_test(cwd, test, out, logfname, interp, test_driver, runfunc, timeout=None): args = execute_args(cwd, test, logfname, interp, test_driver) - exitcode = runfunc(args, cwd, out, timeout=timeout) + with out.open('w') as fp: + exitcode = runfunc(args, cwd, fp, timeout=timeout) return exitcode diff --git a/testrunner/util.py b/testrunner/util.py --- a/testrunner/util.py +++ b/testrunner/util.py @@ -136,29 +136,27 @@ def run(args, cwd, out, timeout=None): - with out.open('w') as f: - try: - p = subprocess.Popen(args, cwd=str(cwd), stdout=f, stderr=f) - except Exception, e: - f.write("Failed to run %s with cwd='%s' timeout=%s:\n" - " %s\n" - % (args, cwd, timeout, e)) - return RUNFAILED + try: + p = subprocess.Popen(args, cwd=str(cwd), stdout=f, stderr=f) + except Exception, e: + f.write("Failed to run %s with cwd='%s' timeout=%s:\n" + " %s\n" + % (args, cwd, timeout, e)) + return RUNFAILED - if timeout is None: - return p.wait() - else: - returncode = busywait(p, timeout) - if returncode is not None: - return returncode - # timeout! - _kill(p.pid, SIGTERM) - if busywait(p, 10) is None: - _kill(p.pid, SIGKILL) - return TIMEDOUT + if timeout is None: + return p.wait() + else: + returncode = busywait(p, timeout) + if returncode is not None: + return returncode + # timeout! + _kill(p.pid, SIGTERM) + if busywait(p, 10) is None: + _kill(p.pid, SIGKILL) + return TIMEDOUT def dry_run(args, cwd, out, timeout=None): - with out.open('w') as f: - f.write("run %s with cwd='%s' timeout=%s\n" % (args, cwd, timeout)) + out.write("run %s with cwd='%s' timeout=%s\n" % (args, cwd, timeout)) return 0 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit