"""Regression tests for KIN-109: Auto-test должен использовать python3.11 вместо python3 (ссылается на 3.14). Root cause: Makefile test target used bare `pytest tests/` which resolves to the system pytest (Python 3.14). Tests written for Python 3.11 could fail under 3.14. Fix: Makefile test target changed to `python3.11 -m pytest tests/`. Coverage: (1) Makefile test target uses python3.11, not bare pytest (2) _detect_test_command still returns 'make test' for projects with Makefile """ import re from pathlib import Path # --------------------------------------------------------------------------- # (1) Makefile — test target uses python3.11 -m pytest # --------------------------------------------------------------------------- class TestMakefileTestTarget: def test_makefile_test_uses_python311(self): """Makefile test target must use python3.11 -m pytest, not bare pytest.""" makefile = Path(__file__).parent.parent / "Makefile" assert makefile.is_file(), "Makefile must exist in project root" content = makefile.read_text() # Find test target block m = re.search(r"^test\s*:.*?\n((?:\t.+\n?)*)", content, re.MULTILINE) assert m is not None, "Makefile must have a 'test:' target" test_body = m.group(1) assert "python3.11 -m pytest" in test_body, ( f"Makefile test target must use 'python3.11 -m pytest', got:\n{test_body!r}" ) def test_makefile_test_does_not_use_bare_pytest(self): """Makefile test target must NOT use bare 'pytest' (would pick up Python 3.14).""" makefile = Path(__file__).parent.parent / "Makefile" content = makefile.read_text() m = re.search(r"^test\s*:.*?\n((?:\t.+\n?)*)", content, re.MULTILINE) assert m is not None test_body = m.group(1) # Bare pytest call (not prefixed by python3.11 -m) bare_pytest = re.search(r"(?