launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25850
[Merge] ~cjwatson/launchpad:faster-retest into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:faster-retest into launchpad:master.
Commit message:
Adjust retest script to use --load-list
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/395290
This is much faster than lots of -t options when there are many tests to run.
I'm using retest a lot for Python 3 porting at the moment, and this makes a noticeable difference.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:faster-retest into launchpad:master.
diff --git a/lib/lp/testing/utilities/retest.py b/lib/lp/testing/utilities/retest.py
index 740f063..570acb9 100755
--- a/lib/lp/testing/utilities/retest.py
+++ b/lib/lp/testing/utilities/retest.py
@@ -24,11 +24,13 @@ report (or a part of) can be piped in, for example by pasting it:
from __future__ import print_function
+from collections import OrderedDict
import fileinput
from itertools import takewhile
import os
import re
import sys
+import tempfile
from six.moves import map as imap
@@ -88,7 +90,12 @@ def gen_tests(test_lines):
def extract_tests(lines):
- return set(gen_tests(gen_test_lines(lines)))
+ # Deduplicate test IDs. We don't have a convenient ordered set type,
+ # but an OrderedDict is good enough.
+ tests = OrderedDict()
+ for test in gen_tests(gen_test_lines(lines)):
+ tests[test] = None
+ return list(tests.keys())
def run_tests(tests):
@@ -97,10 +104,12 @@ def run_tests(tests):
for test in tests:
print(" %s" % test)
args = ['-vvc'] if sys.stdout.isatty() else ['-vv']
- for test in tests:
- args.append('-t')
- args.append(re.escape(test))
- os.execl(TEST, TEST, *args)
+ with tempfile.NamedTemporaryFile(mode='w+') as test_list:
+ for test in tests:
+ print(test, file=test_list)
+ test_list.flush()
+ args.extend(['--load-list', test_list.name])
+ os.execl(TEST, TEST, *args)
def main():