okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge main (87dfca0e7) into f-own-int: the 0.2.14 app branch, fixtures and CI fixes, the Qwen4-readiness tools, the shape-engine build scriptsffb3d9b31

main
1.5 KiB26 linesraw
1"""Terminal tests do not depend on the graphics card of the box they run on.
2
3The Drafting step of `strata launch` (and the Drafting line of the summary) exists only where the engine can run DFlash2 (CUDA or HIP), so the number
4of steps and the layout of the summary used to differ between an Nvidia box and an Intel one. Every test starts on a computer with no card the engine
5knows; a test about drafting names the card it means (test_drafting.py and test_drafting_hardware.py patch `detect_hardware` themselves)."""
6import os
7from unittest import mock
8
9import pytest
10
11# The tests draw the full look (Windows Terminal, Linux, macOS). A Windows run with no modern-terminal marker (a CI runner, a classic console)
12# would get the classic console's ASCII / solid look and its "use Windows Terminal" tip line instead; the tests of that look patch
13# consoleinfo or set STRATA_GLYPHS themselves.
14if os.name == "nt" and not any(os.environ.get(k) for k in ("STRATA_GLYPHS", "WT_SESSION", "TERM_PROGRAM", "ConEmuANSI", "ANSICON")) \
15        and not os.environ.get("TERM", "").startswith(("xterm", "screen", "tmux", "vt")):
16    os.environ["STRATA_GLYPHS"] = "unicode"
17
18
19@pytest.fixture(autouse=True)
20def _no_card_unless_a_test_names_one(request):
21    from strata_control import drafting
22    if request.module.__name__.rsplit(".", 1)[-1].startswith("test_drafting"):
23        yield                                    # these name their card themselves (setUpModule / per test)
24        return
25    with mock.patch.object(drafting, "detect_hardware", return_value=("cpu", [])):
26        yield