@@ -125,24 +125,6 @@ def __str__(self) -> str:
125
125
# the test is running in background
126
126
PROGRESS_MIN_TIME = 30.0 # seconds
127
127
128
- # small set of tests to determine if we have a basically functioning interpreter
129
- # (i.e. if any of these fail, then anything else is likely to follow)
130
- STDTESTS = [
131
- 'test_grammar' ,
132
- 'test_opcodes' ,
133
- 'test_dict' ,
134
- 'test_builtin' ,
135
- 'test_exceptions' ,
136
- 'test_types' ,
137
- 'test_unittest' ,
138
- 'test_doctest' ,
139
- 'test_doctest2' ,
140
- 'test_support'
141
- ]
142
-
143
- # set of tests that we don't want to be executed when using regrtest
144
- NOTTESTS = set ()
145
-
146
128
#If these test directories are encountered recurse into them and treat each
147
129
# test_ .py or dir as a separate test module. This can increase parallelism.
148
130
# Beware this can't generally be done for any directory with sub-tests as the
@@ -166,22 +148,38 @@ def findtestdir(path=None):
166
148
return path or os .path .dirname (os .path .dirname (__file__ )) or os .curdir
167
149
168
150
169
- def findtests (testdir = None , stdtests = STDTESTS , nottests = NOTTESTS , * , split_test_dirs = SPLITTESTDIRS , base_mod = "" ):
151
+ def findtests (* , testdir = None , exclude = (),
152
+ split_test_dirs = SPLITTESTDIRS , base_mod = "" ):
170
153
"""Return a list of all applicable test modules."""
171
154
testdir = findtestdir (testdir )
172
- names = os .listdir (testdir )
173
155
tests = []
174
- others = set (stdtests ) | nottests
175
- for name in names :
156
+ for name in os .listdir (testdir ):
176
157
mod , ext = os .path .splitext (name )
177
- if mod [:5 ] == "test_" and mod not in others :
178
- if mod in split_test_dirs :
179
- subdir = os .path .join (testdir , mod )
180
- mod = f"{ base_mod or 'test' } .{ mod } "
181
- tests .extend (findtests (subdir , [], nottests , split_test_dirs = split_test_dirs , base_mod = mod ))
182
- elif ext in (".py" , "" ):
183
- tests .append (f"{ base_mod } .{ mod } " if base_mod else mod )
184
- return stdtests + sorted (tests )
158
+ if (not mod .startswith ("test_" )) or (mod in exclude ):
159
+ continue
160
+ if mod in split_test_dirs :
161
+ subdir = os .path .join (testdir , mod )
162
+ mod = f"{ base_mod or 'test' } .{ mod } "
163
+ tests .extend (findtests (testdir = subdir , exclude = exclude ,
164
+ split_test_dirs = split_test_dirs , base_mod = mod ))
165
+ elif ext in (".py" , "" ):
166
+ tests .append (f"{ base_mod } .{ mod } " if base_mod else mod )
167
+ return sorted (tests )
168
+
169
+
170
+ def split_test_packages (tests , * , testdir = None , exclude = (),
171
+ split_test_dirs = SPLITTESTDIRS ):
172
+ testdir = findtestdir (testdir )
173
+ splitted = []
174
+ for name in tests :
175
+ if name in split_test_dirs :
176
+ subdir = os .path .join (testdir , name )
177
+ splitted .extend (findtests (testdir = subdir , exclude = exclude ,
178
+ split_test_dirs = split_test_dirs ,
179
+ base_mod = name ))
180
+ else :
181
+ splitted .append (name )
182
+ return splitted
185
183
186
184
187
185
def get_abs_module (ns : Namespace , test_name : str ) -> str :
0 commit comments