kin: auto-commit after pipeline
This commit is contained in:
parent
e7e0342aeb
commit
38fd7da3e6
3 changed files with 77 additions and 2 deletions
2
Makefile
2
Makefile
|
|
@ -28,7 +28,7 @@ serve:
|
||||||
uvicorn web.api:app --host 0.0.0.0 --port 8000
|
uvicorn web.api:app --host 0.0.0.0 --port 8000
|
||||||
|
|
||||||
test:
|
test:
|
||||||
pytest tests/
|
python3.11 -m pytest tests/
|
||||||
cd $(FRONTEND_DIR) && npm run test
|
cd $(FRONTEND_DIR) && npm run test
|
||||||
|
|
||||||
deploy: build-frontend
|
deploy: build-frontend
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ class TestCreateWorktree:
|
||||||
|
|
||||||
@patch("subprocess.run")
|
@patch("subprocess.run")
|
||||||
def test_create_worktree_sanitizes_step_name(self, mock_run, tmp_path):
|
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
|
from core.worktree import create_worktree
|
||||||
mock_run.return_value = _ok_run()
|
mock_run.return_value = _ok_run()
|
||||||
|
|
||||||
|
|
|
||||||
75
tests/test_kin_109_regression.py
Normal file
75
tests/test_kin_109_regression.py
Normal file
|
|
@ -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"(?<!python3\.11 -m )(?<!\w)pytest\b", test_body)
|
||||||
|
assert bare_pytest is None, (
|
||||||
|
f"Makefile test target must not use bare 'pytest', got:\n{test_body!r}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# (2) _detect_test_command still returns 'make test' for Makefile projects
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class TestDetectTestCommandUnchanged:
|
||||||
|
def test_detect_returns_make_test_for_makefile(self, tmp_path):
|
||||||
|
"""_detect_test_command must return 'make test' when Makefile has test target."""
|
||||||
|
from agents.runner import _detect_test_command
|
||||||
|
|
||||||
|
(tmp_path / "Makefile").write_text("test:\n\tpython3.11 -m pytest\n")
|
||||||
|
assert _detect_test_command(str(tmp_path)) == "make test"
|
||||||
|
|
||||||
|
def test_kin_project_detects_make_test(self):
|
||||||
|
"""kin project itself must auto-detect 'make test' (has Makefile with test target)."""
|
||||||
|
from agents.runner import _detect_test_command
|
||||||
|
|
||||||
|
project_root = str(Path(__file__).parent.parent)
|
||||||
|
result = _detect_test_command(project_root)
|
||||||
|
assert result == "make test", (
|
||||||
|
f"kin project should detect 'make test', got {result!r}"
|
||||||
|
)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue