Skip to content

Commit 1db80fd

Browse files
committed
test_tagged_unittests.py: add TAGGED_UNITTEST_SELECTION env var to run the gate on a selection of tagged unittests only
1 parent f2496f9 commit 1db80fd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0
@@ -40,9 +40,8 @@
4040
import glob
4141
import os
4242
import subprocess
43-
import test
44-
4543
import sys
44+
import test
4645

4746
if os.environ.get("ENABLE_CPYTHON_TAGGED_UNITTESTS") == "true" or __name__ == "__main__":
4847
TAGS_DIR = os.path.join(os.path.dirname(__file__), "unittest_tags")
@@ -139,7 +138,14 @@ class TestTaggedUnittests(unittest.TestCase):
139138
total = 1
140139
assert selected < total
141140

142-
working_tests = collect_working_tests()[selected::total]
141+
working_tests = collect_working_tests()
142+
selection = os.environ.get('TAGGED_UNITTEST_SELECTION')
143+
if not selection:
144+
working_tests = working_tests[selected::total]
145+
else:
146+
selection = set(s.strip() for s in selection.split(","))
147+
working_tests = [x for x in working_tests if x in selection]
148+
143149
for idx, working_test in enumerate(working_tests):
144150
fn = make_test_function(working_test)
145151
fn.__name__ = "%s[%d/%d]" % (fn.__name__, idx + 1, len(working_tests))

0 commit comments

Comments
 (0)