fix: harden WASM phase 5 harness
This commit is contained in:
@@ -222,6 +222,7 @@ def filter_cases(
|
||||
name_pattern: Optional[str],
|
||||
tags: List[str],
|
||||
include_internal: bool,
|
||||
excluded_names: List[str],
|
||||
) -> List[NetworkTestCase]:
|
||||
filtered = list(cases)
|
||||
if plugins:
|
||||
@@ -233,6 +234,9 @@ def filter_cases(
|
||||
filtered = [case for case in filtered if matcher.search(case.name)]
|
||||
if tags:
|
||||
filtered = [case for case in filtered if any(tag in case.tags for tag in tags)]
|
||||
if excluded_names:
|
||||
excluded = set(excluded_names)
|
||||
filtered = [case for case in filtered if case.name not in excluded]
|
||||
return filtered
|
||||
|
||||
|
||||
@@ -273,6 +277,7 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
parser.add_argument("--plugin-dir", default=str(base_dir / "plugins"), help="directory containing plugin files")
|
||||
parser.add_argument("--plugin", action="append", default=[], help="limit to one or more plugin basenames")
|
||||
parser.add_argument("--match", help="regex filter for case names")
|
||||
parser.add_argument("--exclude", action="append", default=[], help="exclude an exact test case name after other filters")
|
||||
parser.add_argument("--tag", action="append", default=[], help="only run cases with at least one matching tag")
|
||||
parser.add_argument("--include-internal", action="store_true", help="include tests tagged internal in the run")
|
||||
parser.add_argument("--list", action="store_true", help="list discovered tests without running them")
|
||||
@@ -316,7 +321,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
for plugin_path in plugin_files:
|
||||
register_plugin_cases(registry, plugin_path)
|
||||
|
||||
cases = filter_cases(registry.cases, args.plugin, args.match, args.tag, args.include_internal)
|
||||
cases = filter_cases(registry.cases, args.plugin, args.match, args.tag, args.include_internal, args.exclude)
|
||||
if not cases:
|
||||
print("No tests matched the selected filters", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
Reference in New Issue
Block a user