diff --git a/scripts/ci/test_reds.py b/scripts/ci/test_reds.py index 93e7dbe8207d..6ea8f4da42c9 100644 --- a/scripts/ci/test_reds.py +++ b/scripts/ci/test_reds.py @@ -135,7 +135,10 @@ def __init__(self, own: bool, reasons: list, shared: list = ()): def lines_of(log: str) -> list[str]: - return [STAMP.sub("", ANSI.sub("", line)).rstrip() for line in log.splitlines()] + # Swift Testing prefixes some event lines with a zero-width space (U+200B) when another writer's output + # shares the stream ("\u200b✔ Suite \"x\" passed"); left in, the anchored suite patterns miss the line and + # a suite that passed reads as never finished (https://github.com/manaflow-ai/cmux/pull/35296). + return [STAMP.sub("", ANSI.sub("", line)).lstrip("\u200b").rstrip() for line in log.splitlines()] def _words(text: str, words: list[str]) -> None: diff --git a/tests/test_test_reds.py b/tests/test_test_reds.py index 2849bc29993a..94310a8bd5ef 100644 --- a/tests/test_test_reds.py +++ b/tests/test_test_reds.py @@ -110,6 +110,14 @@ def test_a_whole_parameterized_run_is_not_cut_off(self): "✘ Test a() failed after 0.1 seconds with 1 issue.", SUMMARY) self.assertEqual(reds.read(whole).truncated, []) + def test_a_suite_end_after_a_zero_width_space_is_whole(self): + # PR 35296's app-host shard 2: Swift Testing printed "\u200b✔ Suite ... passed" after interleaved app logs. + whole = log('◇ Suite "Cloud sidebar recorded interaction" started.', + '\u200b✔ Suite "Cloud sidebar recorded interaction" passed after 0.001 seconds.', SUMMARY) + self.assertEqual(reds.read(whole).truncated, []) + cut = log('\u200b◇ Suite "s" started.', SUMMARY) + self.assertIn('1 suite(s) started and never finished: "s"', reds.read(cut).truncated) + def test_a_run_cut_off_between_tests_is_the_heads_own(self): cut = log("◇ Test run started.", "◇ Suite S started.", "◇ Test a() started.", failed("a()"), "✘ Test a() failed after 0.1 seconds with 1 issue.")