okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
ffb3d9b31
main
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" )) \ 15and not os .environ .get ("TERM" ,"" ).startswith (("xterm" ,"screen" ,"tmux" ,"vt" )): 16os .environ ["STRATA_GLYPHS" ]= "unicode" 17 18 19@ pytest . fixture ( autouse = True ) 20def _no_card_unless_a_test_names_one (request ): 21from strata_control import drafting 22if request .module .__name__ .rsplit ("." ,1 )[- 1 ].startswith ("test_drafting" ): 23yield # these name their card themselves (setUpModule / per test) 24return 25with mock .patch .object (drafting ,"detect_hardware" ,return_value = ("cpu" , [])): 26yield