Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/ci/test_reds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_test_reds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
Loading