test(console): build the width test console outside Rich legacy Windows mode

This commit is contained in:
imSp4rky
2026-12-05 21:04:27 -07:00
parent 2ee4e25742
commit 9e9470c7ed
+3
View File
@@ -6,6 +6,8 @@ from pathlib import Path
import pytest
SCRIPT = """
import rich.console
rich.console.detect_legacy_windows = lambda: False
from unshackle.core.config import config
config.wide_output = {wide}
from rich.padding import Padding
@@ -31,6 +33,7 @@ def test_console_follows_wide_output(wide: bool, width: int) -> None:
"""With wide_output the console takes the terminal width and track bars fill the line to one right edge.
Without it the console holds 80 columns and each bar 40 cells. Both are read at import, hence the subprocess.
The child turns off Rich legacy Windows mode, which on a Windows pipe drops one column and draws ASCII bars.
"""
out = subprocess.run(
[sys.executable, "-c", SCRIPT.format(wide=wide)],