Skip to content

Commit d6dcac5

Browse files
committed
Add a way to untag nonexistent tests
1 parent 59ff611 commit d6dcac5

File tree

1 file changed

+16
-0
lines changed
  • graalpython/com.oracle.graal.python.test/src

1 file changed

+16
-0
lines changed

graalpython/com.oracle.graal.python.test/src/runner.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,8 @@ def main():
12081208
help="Show durations of N slowest tests (-1 to show all)")
12091209
parser.add_argument('--mx-report',
12101210
help="Produce a json report file in format expected by mx_gate.make_test_report")
1211+
parser.add_argument('--untag-unmatched', action='store_true',
1212+
help="Remove tests that were not collected from tags. Useful for pruning removed tests")
12111213
parser.add_argument(
12121214
'--subprocess-args',
12131215
type=shlex.split,
@@ -1286,6 +1288,20 @@ def main():
12861288
if not tests:
12871289
sys.exit("No tests matched\n")
12881290

1291+
if args.untag_unmatched:
1292+
for test_suite in tests:
1293+
test_file = test_suite.test_file
1294+
tags = read_tags(test_file)
1295+
if tags:
1296+
filtered_tags = []
1297+
for tag in tags:
1298+
if not any(tag.test_id.test_name == test.test_id.test_name for test in test_suite.collected_tests):
1299+
log(f"Removing tag for {test_file}::{tag.test_id.test_name}")
1300+
else:
1301+
filtered_tags.append(tag)
1302+
write_tags(test_file, filtered_tags)
1303+
return
1304+
12891305
runner_args = dict(
12901306
failfast=args.failfast,
12911307
report_durations=args.durations,

0 commit comments

Comments
 (0)