Skip to content

Commit e5273d5

Browse files
committed
Retagger: Don't use empty tag files to mean all tests
1 parent 2b217ad commit e5273d5

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def fun(self):
144144
testmod = "test." + testfile_stem
145145
cmd = [timeout, "-s", "9", "60"] + executable + ["-S", "-m"]
146146
tagfile = os.path.join(TAGS_DIR, testfile_stem + ".txt")
147-
if retag:
147+
if retag and repeat == 0:
148148
test_selectors = []
149149
else:
150150
test_selectors = working_selectors(tagfile)
@@ -167,17 +167,7 @@ def fun(self):
167167
print("*stderr*")
168168
print(p.stderr)
169169

170-
if p.returncode == 0 and not os.path.exists(tagfile):
171-
# if we're re-tagging a test without tags, all passed
172-
with open(tagfile, "w") as f:
173-
pass
174-
break
175-
elif p.returncode == 0:
176-
# we ran the tagged tests and they were fine
177-
break
178-
elif repeat < maxrepeats:
179-
# we failed the first run, create a tag file with the passing
180-
# tests (if any)
170+
if repeat < maxrepeats:
181171
passing_tests = []
182172
failed_tests = []
183173

@@ -219,7 +209,7 @@ def get_pass_name(funcname, classname):
219209
# the passed patterns
220210
passing_only_patterns = set(passing_tests) - set(failed_tests)
221211
with open(tagfile, "w") as f:
222-
for passing_test in passing_only_patterns:
212+
for passing_test in sorted(passing_only_patterns):
223213
f.write(passing_test)
224214
f.write("\n")
225215
if not passing_only_patterns:
@@ -228,3 +218,6 @@ def get_pass_name(funcname, classname):
228218
# we tried the last time and failed, so our tags don't work for
229219
# some reason
230220
os.unlink(tagfile)
221+
222+
if p.returncode == 0:
223+
break

0 commit comments

Comments
 (0)