# HG changeset patch # User Matt Mackall # Date 1320351490 18000 # Node ID 3b7c4f96885ceec106de5cfd64c1a04c76b65587 # Parent 8c90b3df5bedc6d9d3ad9fcf3ebeff8a230412b0 run-tests: minor cleanups diff -r 8c90b3df5bed -r 3b7c4f96885c tests/run-tests.py --- a/tests/run-tests.py Thu Nov 03 15:08:45 2011 -0500 +++ b/tests/run-tests.py Thu Nov 03 15:18:10 2011 -0500 @@ -559,10 +559,6 @@ return False def tsttest(test, wd, options, replacements): - t = open(test) - out = [] - script = [] - # We generate a shell script which outputs unique markers to line # up script results with our source. These markers include input # line number and the last return code @@ -584,6 +580,11 @@ # can generate the surrounding doctest magic inpython = False + f = open(test) + t = f.readlines() + f.close() + + script = [] for n, l in enumerate(t): if not l.endswith('\n'): l += '\n' @@ -623,12 +624,11 @@ # non-command/result - queue up for merged output after.setdefault(pos, []).append(l) - t.close() - if inpython: script.append("EOF\n") addsalt(n + 1) + # Write out the script and execute it fd, name = tempfile.mkstemp(suffix='hg-tst') try: for l in script: