]> granicus.if.org Git - python/commitdiff
regrtest --fromfile now accepts a list of filenames
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 9 Dec 2016 15:05:51 +0000 (16:05 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 9 Dec 2016 15:05:51 +0000 (16:05 +0100)
Lib/test/libregrtest/main.py

index f0effc973c1b3abdc281da3cca25a8cc0025cce8..e113ed63ddf3b69c4713be8892ae27b5d477ac7f 100644 (file)
@@ -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)