Skip to content

Commit 5411997

Browse files
committed
Merge #10374: qa: Warn when specified test is not found
fac79e4 qa: Warn when specified test is not found (MarcoFalke) Tree-SHA512: d11ecdde275309b12e23155f6cd8e26c99217436b5094a70dd51b95ae7688754227628dd9a801eb6a52ff3ebea4420938e2fc8e9dc9cd77a4dd5c28d2b822354
2 parents b45a52a + fac79e4 commit 5411997

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ You can run any single test by calling
3434

3535
test/functional/test_runner.py <testname>
3636

37-
Or you can run any combination of tests by calling
37+
Or you can run any combination (incl. duplicates) of tests by calling
3838

3939
test/functional/test_runner.py <testname1> <testname2> <testname3> ...
4040

test/functional/test_runner.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def main():
163163
Help text and arguments for individual test script:''',
164164
formatter_class=argparse.RawTextHelpFormatter)
165165
parser.add_argument('--coverage', action='store_true', help='generate a basic coverage report for the RPC interface')
166-
parser.add_argument('--exclude', '-x', help='specify a comma-seperated-list of scripts to exclude. Do not include the .py extension in the name.')
166+
parser.add_argument('--exclude', '-x', help='specify a comma-seperated-list of scripts to exclude.')
167167
parser.add_argument('--extended', action='store_true', help='run the extended test suite in addition to the basic tests')
168168
parser.add_argument('--force', '-f', action='store_true', help='run tests even on platforms where they are disabled by default (e.g. windows).')
169169
parser.add_argument('--help', '-h', '-?', action='store_true', help='print help text and exit')
@@ -172,8 +172,8 @@ def main():
172172
parser.add_argument('--quiet', '-q', action='store_true', help='only print results summary and failure logs')
173173
args, unknown_args = parser.parse_known_args()
174174

175-
# Create a set to store arguments and create the passon string
176-
tests = set(arg for arg in unknown_args if arg[:2] != "--")
175+
# args to be passed on always start with two dashes; tests are the remaining unknown args
176+
tests = [arg for arg in unknown_args if arg[:2] != "--"]
177177
passon_args = [arg for arg in unknown_args if arg[:2] == "--"]
178178

179179
# Read config generated by configure.
@@ -206,8 +206,13 @@ def main():
206206
if tests:
207207
# Individual tests have been specified. Run specified tests that exist
208208
# in the ALL_SCRIPTS list. Accept the name with or without .py extension.
209-
test_list = [t for t in ALL_SCRIPTS if
210-
(t in tests or re.sub(".py$", "", t) in tests)]
209+
tests = [re.sub("\.py$", "", t) + ".py" for t in tests]
210+
test_list = []
211+
for t in tests:
212+
if t in ALL_SCRIPTS:
213+
test_list.append(t)
214+
else:
215+
print("{}WARNING!{} Test '{}' not found in full test list.".format(BOLD[1], BOLD[0], t))
211216
else:
212217
# No individual tests have been specified.
213218
# Run all base tests, and optionally run extended tests.
@@ -219,9 +224,12 @@ def main():
219224

220225
# Remove the test cases that the user has explicitly asked to exclude.
221226
if args.exclude:
222-
for exclude_test in args.exclude.split(','):
223-
if exclude_test + ".py" in test_list:
224-
test_list.remove(exclude_test + ".py")
227+
tests_excl = [re.sub("\.py$", "", t) + ".py" for t in args.exclude.split(',')]
228+
for exclude_test in tests_excl:
229+
if exclude_test in test_list:
230+
test_list.remove(exclude_test)
231+
else:
232+
print("{}WARNING!{} Test '{}' not found in current test list.".format(BOLD[1], BOLD[0], exclude_test))
225233

226234
if not test_list:
227235
print("No valid test scripts specified. Check that your test is in one "

0 commit comments

Comments
 (0)