summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-12-09 15:05:51 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-12-09 15:05:51 (GMT)
commitc24217e144c750a1452ca42524230630d022873f (patch)
tree53becd2e0c424ceb0e8072a5f5460ff0b2953d11 /Lib/test/libregrtest
parentb6ed57d9802c5aa381d72daad894166ef02c6e48 (diff)
downloadcpython-c24217e144c750a1452ca42524230630d022873f.zip
cpython-c24217e144c750a1452ca42524230630d022873f.tar.gz
cpython-c24217e144c750a1452ca42524230630d022873f.tar.bz2
regrtest --fromfile now accepts a list of filenames
Diffstat (limited to 'Lib/test/libregrtest')
-rw-r--r--Lib/test/libregrtest/main.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index f0effc9..e113ed6 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -179,19 +179,17 @@ class Regrtest:
self.tests = []
# regex to match 'test_builtin' in line:
# '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'(test_[a-zA-Z0-9_]+)')
+ r'(test_[a-zA-Z0-9_]+)\b(?:\.py)?')
regex = re.compile(regex)
with open(os.path.join(support.SAVEDCWD, self.ns.fromfile)) as fp:
for line in fp:
+ line = line.split('#', 1)[0]
line = line.strip()
- if line.startswith('#'):
- continue
- match = regex.match(line)
- if match is None:
- continue
- self.tests.append(match.group(1))
+ match = regex.search(line)
+ if match is not None:
+ self.tests.append(match.group(1))
removepy(self.tests)