mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-08-17 16:37:30 +02:00
Test Windows console and path portability contracts
Cover legacy console fallbacks, platform temp paths, local UI disk probing, and lazy analysis exports. Bind the new local UI test to the executable source-to-test risk map.
This commit is contained in:
@@ -154,3 +154,46 @@ class TestCLIDispatch:
|
||||
args_passed = mock_cmd.call_args[0][0]
|
||||
assert args_passed.contribute is True
|
||||
assert args_passed.contribute_notes == "Testing contribution system"
|
||||
|
||||
|
||||
class _EncodingOnlyStdout:
|
||||
"""Minimal stream stand-in for encoding-selection tests."""
|
||||
|
||||
def __init__(self, encoding: str | None) -> None:
|
||||
self.encoding = encoding
|
||||
|
||||
|
||||
class TestConsoleEncoding:
|
||||
"""The CLI must remain renderable on legacy Windows code pages."""
|
||||
|
||||
@pytest.mark.parametrize("encoding", ["cp1252", "ascii", "not-a-codec"])
|
||||
def test_console_text_falls_back_when_text_is_not_encodable(self, encoding):
|
||||
from obliteratus.cli import _console_text
|
||||
|
||||
with patch("sys.stdout", _EncodingOnlyStdout(encoding)):
|
||||
assert _console_text("█→", "FALLBACK") == "FALLBACK"
|
||||
|
||||
@pytest.mark.parametrize("encoding", ["utf-8", None])
|
||||
def test_console_text_keeps_unicode_on_utf8_compatible_streams(self, encoding):
|
||||
from obliteratus.cli import _console_text
|
||||
|
||||
with patch("sys.stdout", _EncodingOnlyStdout(encoding)):
|
||||
assert _console_text("█→", "FALLBACK") == "█→"
|
||||
|
||||
def test_banner_degrades_to_ascii_on_cp1252(self):
|
||||
from obliteratus.cli import _banner_for_console
|
||||
|
||||
with patch("sys.stdout", _EncodingOnlyStdout("cp1252")):
|
||||
banner = _banner_for_console()
|
||||
|
||||
assert "OBLITERATUS" in banner
|
||||
assert banner.isascii()
|
||||
|
||||
def test_main_renders_selected_banner(self):
|
||||
with (
|
||||
patch("sys.stdout", _EncodingOnlyStdout("cp1252")),
|
||||
patch("obliteratus.cli.console") as mock_console,
|
||||
):
|
||||
main(["models"])
|
||||
|
||||
assert mock_console.print.call_args_list[0].args[0].isascii()
|
||||
|
||||
Reference in New Issue
Block a user