regrtest --fromfile now accepts a list of filenames

This commit is contained in:
Victor Stinner 2016-12-09 16:05:51 +01:00
parent b6ed57d980
commit c24217e144
1 changed files with 6 additions and 8 deletions

View File

@ -179,19 +179,17 @@ class Regrtest:
self.tests = [] self.tests = []
# regex to match 'test_builtin' in line: # regex to match 'test_builtin' in line:
# '0:00:00 [ 4/400] test_builtin -- test_dict took 1 sec' # '0:00:00 [ 4/400] test_builtin -- test_dict took 1 sec'
regex = (r'^(?:[0-9]+:[0-9]+:[0-9]+ *)?' regex = (r'(?:[0-9]+:[0-9]+:[0-9]+ *)?'
r'(?:\[[0-9/ ]+\] *)?' r'(?:\[[0-9/ ]+\] *)?'
r'(test_[a-zA-Z0-9_]+)') r'(test_[a-zA-Z0-9_]+)\b(?:\.py)?')
regex = re.compile(regex) regex = re.compile(regex)
with open(os.path.join(support.SAVEDCWD, self.ns.fromfile)) as fp: with open(os.path.join(support.SAVEDCWD, self.ns.fromfile)) as fp:
for line in fp: for line in fp:
line = line.split('#', 1)[0]
line = line.strip() line = line.strip()
if line.startswith('#'): match = regex.search(line)
continue if match is not None:
match = regex.match(line) self.tests.append(match.group(1))
if match is None:
continue
self.tests.append(match.group(1))
removepy(self.tests) removepy(self.tests)