okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
326e39118
main
1"""Closing always ends the engine: the close-path matrix (tests/terminal/lifecycle_matrix.py) with the fake engine. 2 3Each case starts `strata serve` or `strata runtime start` with an engine package whose entry point is a script, 4ends it one way, and asserts that no process of the tree is left, the port is free and the runtime lease can be taken. 5The cases that need a real console window on Windows run when STRATA_MATRIX_CONSOLE=1 (they open a minimised 6console); everything else runs everywhere the platform has the mechanism. 7""" 8import os 9import unittest 10 11from tests .terminal import lifecycle_matrix as matrix 12 13CONSOLE = {"serve-ctrl-c" ,"serve-console-close" } 14 15 16@ unittest . skipUnless ( os . name in ( "posix" , "nt" ), "no qualified owner transport on this platform" ) 17class LifecycleMatrix (unittest .TestCase ): 18pass 19 20 21def make (name ): 22def test (self ): 23if matrix .WINDOWS and name in CONSOLE and not os .environ .get ("STRATA_MATRIX_CONSOLE" ): 24self .skipTest ("needs a console window; set STRATA_MATRIX_CONSOLE=1" ) 25result = matrix .run ([name ])[0 ] 26self .assertTrue (result ["ok" ],result .get ("problems" )) 27return test 28 29 30for _name in matrix .SCENARIOS : 31if matrix .applicable (_name ): 32setattr (LifecycleMatrix ,"test_" + _name .replace ("-" ,"_" ),make (_name )) 33 34 35if __name__ == "__main__" : 36unittest .main ()