Fix throw of ExternalTestNotFound in external_tests.py

This commit is contained in:
Rodrigo Q. Saramago 2023-04-28 17:49:00 +02:00
parent 8be32f2267
commit 75960e6db8
No known key found for this signature in database
GPG Key ID: 9B36B2525704A359

View File

@ -59,11 +59,17 @@ def run_external_tests(args: dict):
solc_binary_path = args["solc_binary_path"]
all_test_scripts = detect_external_tests()
if args["run_all"]:
run_test_scripts(solc_binary_type, solc_binary_path, all_test_scripts)
else:
selected_tests = args["selected_tests"]
if selected_tests:
if args["run_all"]:
assert len(selected_tests) == 0
run_test_scripts(solc_binary_type, solc_binary_path, all_test_scripts)
return
if len(selected_tests) == 0:
raise ExternalTestNotFound(
"External test was not selected. Please use --run or --run-all option"
)
unrecognized_tests = set(selected_tests) - set(all_test_scripts.keys())
if unrecognized_tests != set():
raise ExternalTestNotFound(
@ -74,9 +80,6 @@ def run_external_tests(args: dict):
solc_binary_path,
{k: all_test_scripts[k] for k in selected_tests},
)
raise ExternalTestNotFound(
"External test was not selected. Please use --run or --run-all option"
)
def parse_commandline() -> Namespace: