mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
[chore] clear all 64 pre-existing mypy errors in tests/ (no type:ignore)
Convention: no type:ignore/noqa, and pre-existing violations still violate. The make-quality gate runs 'mypy roboco/ tests/', but the prior commits' gates only ran mypy on production files, masking 64 type errors across 15 test files (method-assign, unused-ignore, no-untyped-def, attr-defined, union-attr, has-type, index, misc). Fixed without any type:ignore: - method-assign (svc.session.X = / svc.method = AsyncMock()): hold a local 'session: MagicMock'/'AsyncMock' and assert on it, or stub via object.__setattr__ / monkeypatch / a typed '_bind' helper returning Any, or alias 'cc: Any = c' (the pattern the file already used). - unused 'type: ignore[assignment]' (real code was method-assign): removed; replaced with the no-suppression patterns above. - 'Callable[...] has no attribute assert_*': keep a typed local ref to the AsyncMock and assert on the local, not the method-typed attr. - no-untyped-def: annotate helper params (Any / pytest.MonkeyPatch). - attr-defined / index / union-attr: type the helper as Any, narrow with an 'is not None' assert, or add the missing attr to a fake. - has-type / return-value: fix the declared return type to the tuple the function actually returns. - PLC0415 inline imports: hoisted to top-level. test_pr_gate_notifies_pm._stub_gate_path converted fully to the 'cc: Any = c' alias (it already used it for one attr) so its five '# type: ignore[method-assign]' suppressions are gone. mypy tests/: 64 errors -> 0 (538 files). ruff check tests/: clean. All 84 tests in the touched files pass.
This commit is contained in:
@@ -49,7 +49,9 @@ def _seed_locks(workspace: Path) -> dict[str, Path]:
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_timeout_removes_stale_git_locks(tmp_path: Path, monkeypatch) -> None:
|
||||
async def test_timeout_removes_stale_git_locks(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""A timed-out git op clears orphaned .git locks before re-raising."""
|
||||
workspace = tmp_path / "ws"
|
||||
(workspace / ".git").mkdir(parents=True)
|
||||
@@ -72,7 +74,7 @@ async def test_timeout_removes_stale_git_locks(tmp_path: Path, monkeypatch) -> N
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_timeout_lock_cleanup_is_best_effort_no_git_dir(
|
||||
tmp_path: Path, monkeypatch
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""A timeout with no .git/ directory must not error the cleanup path."""
|
||||
workspace = tmp_path / "ws"
|
||||
@@ -89,7 +91,9 @@ async def test_timeout_lock_cleanup_is_best_effort_no_git_dir(
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_clean_exit_does_not_touch_locks(tmp_path: Path, monkeypatch) -> None:
|
||||
async def test_clean_exit_does_not_touch_locks(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""A normal (non-timed-out) git op must NOT delete lock files — a concurrent
|
||||
real git process could be holding one. Cleanup is timeout-only."""
|
||||
workspace = tmp_path / "ws"
|
||||
|
||||
Reference in New Issue
Block a user