Skip to content

Commit 379a473

Browse files
committed
Fix tests that were failing on Windows
Cause: rich's Style.render() skips the OSC 8 hyperlink wrapper entirely when legacy_windows=True. Console(force_terminal=True) on Windows auto-detects a legacy console, so the fixture string never contained \x1b]8; — the failure was in the test's setup, not in the pager. Fix (tests/test_pager.py:31): pass legacy_windows=False to the Console, so the fixture emits real hyperlink sequences on every platform.
1 parent a0b2d9e commit 379a473

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tests/test_pager.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ def test_pager_styles_and_wrapping(chop) -> None:
2626
@pytest.mark.parametrize("chop", [False, True])
2727
@pytest.mark.parametrize("terminator", ["\x1b\\", "\x07"], ids=["ST", "BEL"])
2828
def test_pager_rich_hyperlinks(chop, terminator) -> None:
29-
console = Console(force_terminal=True, color_system="standard", no_color=False)
29+
# legacy_windows=False keeps rich from suppressing OSC 8 hyperlinks when the
30+
# tests run against a legacy Windows console.
31+
console = Console(force_terminal=True, color_system="standard", no_color=False, legacy_windows=False)
3032
with console.capture() as capture:
3133
console.print("[link=https://example.com][red]click here[/red][/link] after")
3234
captured = capture.get()

0 commit comments

Comments
 (0)