diff --git a/Makefile b/Makefile index e336fbb..39cb6ab 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ serve: uvicorn web.api:app --host 0.0.0.0 --port 8000 test: - pytest tests/ + python3.11 -m pytest tests/ cd $(FRONTEND_DIR) && npm run test deploy: build-frontend diff --git a/tests/test_kin_103_worktrees.py b/tests/test_kin_103_worktrees.py index ed0f0d5..0af8d4d 100644 --- a/tests/test_kin_103_worktrees.py +++ b/tests/test_kin_103_worktrees.py @@ -120,7 +120,7 @@ class TestCreateWorktree: @patch("subprocess.run") def test_create_worktree_sanitizes_step_name(self, mock_run, tmp_path): - """Слэши и пробелы в step_name заменяются на _ в branch name.""" + """Слэши и пробелы в step_name заменяются на _ в branch name (decision #596).""" from core.worktree import create_worktree mock_run.return_value = _ok_run() diff --git a/tests/test_kin_109_regression.py b/tests/test_kin_109_regression.py new file mode 100644 index 0000000..519ab4b --- /dev/null +++ b/tests/test_kin_109_regression.py @@ -0,0 +1,75 @@ +"""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"(?