Skip to content

Commit 3538585

Browse files
authored
fix: convergence tests leak into --only <label> runs (#1438)
1 parent f85f7fa commit 3538585

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

toolchain/mfc/test/test.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,23 @@ def __filter(cases_) -> typing.Tuple[typing.List[TestCase], typing.List[TestCase
112112
raise MFCException(f"--only filter matched zero test cases. Specified: {ARG('only')}. Check that UUIDs/names are valid.")
113113

114114
# Convergence cases are slow (multiple resolutions × MPI ranks). Skip
115-
# by default unless the user explicitly opted in via --only "Convergence"
116-
# or a convergence UUID. _filter_only above has already narrowed cases
117-
# to the user's selection, so any convergence case still present here
118-
# was selected on purpose. Listing (`-l`) shows all cases regardless.
119-
if not ARG("only") and not ARG("list"):
120-
convergence_cases = [c for c in cases if getattr(c, "kind", "golden") == "convergence"]
121-
if convergence_cases:
115+
# unless the user explicitly opted in via --only "Convergence" or a
116+
# specific convergence UUID. A label like --only "2D" must not
117+
# accidentally pull in "Convergence -> 2D -> ..." cases.
118+
if not ARG("list"):
119+
120+
def is_uuid(term):
121+
return len(term) == 8 and all(c in "0123456789abcdefABCDEF" for c in term)
122+
123+
only_terms = ARG("only")
124+
only_labels = [t for t in only_terms if not is_uuid(t)]
125+
only_uuids = [t for t in only_terms if is_uuid(t)]
126+
127+
convergence_uuids = {c.get_uuid() for c in cases if getattr(c, "kind", "golden") == "convergence"}
128+
user_wants_convergence = "Convergence" in only_labels or any(u in convergence_uuids for u in only_uuids)
129+
130+
if not user_wants_convergence:
131+
convergence_cases = [c for c in cases if getattr(c, "kind", "golden") == "convergence"]
122132
for c in convergence_cases:
123133
cases.remove(c)
124134
skipped_cases.append(c)

0 commit comments

Comments
 (0)