Skip to content

Commit f85d606

Browse files
committed
tests/cli(fix[types]): Use proper pytest.CaptureFixture type for capsys
why: Improve type safety and IDE autocompletion for capsys fixture what: - Replace capsys: t.Any with capsys: pytest.CaptureFixture[str] - Update 11 instances in test_status.py - Update 5 instances in test_list.py
1 parent 020c0cf commit f85d606

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

tests/cli/test_list.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_list_repos(
131131
expected_repo_names: list[str],
132132
tmp_path: pathlib.Path,
133133
monkeypatch: MonkeyPatch,
134-
capsys: t.Any,
134+
capsys: pytest.CaptureFixture[str],
135135
) -> None:
136136
"""Test listing repositories."""
137137
monkeypatch.setenv("HOME", str(tmp_path))
@@ -175,7 +175,7 @@ def test_list_repos(
175175
def test_list_repos_tree_mode(
176176
tmp_path: pathlib.Path,
177177
monkeypatch: MonkeyPatch,
178-
capsys: t.Any,
178+
capsys: pytest.CaptureFixture[str],
179179
) -> None:
180180
"""Test listing repositories in tree mode."""
181181
monkeypatch.setenv("HOME", str(tmp_path))
@@ -214,7 +214,7 @@ def test_list_repos_tree_mode(
214214
def test_list_repos_empty_config(
215215
tmp_path: pathlib.Path,
216216
monkeypatch: MonkeyPatch,
217-
capsys: t.Any,
217+
capsys: pytest.CaptureFixture[str],
218218
) -> None:
219219
"""Test listing with empty config shows appropriate message."""
220220
monkeypatch.setenv("HOME", str(tmp_path))
@@ -240,7 +240,7 @@ def test_list_repos_empty_config(
240240
def test_list_repos_pattern_no_match(
241241
tmp_path: pathlib.Path,
242242
monkeypatch: MonkeyPatch,
243-
capsys: t.Any,
243+
capsys: pytest.CaptureFixture[str],
244244
) -> None:
245245
"""Test listing with pattern that matches nothing."""
246246
monkeypatch.setenv("HOME", str(tmp_path))
@@ -314,7 +314,7 @@ def test_list_repos_path_contraction(
314314
tree: bool,
315315
tmp_path: pathlib.Path,
316316
monkeypatch: MonkeyPatch,
317-
capsys: t.Any,
317+
capsys: pytest.CaptureFixture[str],
318318
) -> None:
319319
"""Test that JSON/NDJSON output contracts home directory paths."""
320320
monkeypatch.setenv("HOME", str(tmp_path))

tests/cli/test_status.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_check_repo_status(
235235
def test_status_repos_all(
236236
tmp_path: pathlib.Path,
237237
monkeypatch: MonkeyPatch,
238-
capsys: t.Any,
238+
capsys: pytest.CaptureFixture[str],
239239
) -> None:
240240
"""Test checking status of all repositories."""
241241
monkeypatch.setenv("HOME", str(tmp_path))
@@ -281,7 +281,7 @@ def test_status_repos_all(
281281
def test_status_repos_json_output(
282282
tmp_path: pathlib.Path,
283283
monkeypatch: MonkeyPatch,
284-
capsys: t.Any,
284+
capsys: pytest.CaptureFixture[str],
285285
) -> None:
286286
"""Test status output in JSON format."""
287287
monkeypatch.setenv("HOME", str(tmp_path))
@@ -334,7 +334,7 @@ def test_status_repos_json_output(
334334
def test_status_repos_detailed(
335335
tmp_path: pathlib.Path,
336336
monkeypatch: MonkeyPatch,
337-
capsys: t.Any,
337+
capsys: pytest.CaptureFixture[str],
338338
) -> None:
339339
"""Test detailed status output."""
340340
monkeypatch.setenv("HOME", str(tmp_path))
@@ -372,7 +372,7 @@ def test_status_repos_detailed(
372372
def test_status_repos_pattern_filter(
373373
tmp_path: pathlib.Path,
374374
monkeypatch: MonkeyPatch,
375-
capsys: t.Any,
375+
capsys: pytest.CaptureFixture[str],
376376
) -> None:
377377
"""Test status with pattern filtering."""
378378
monkeypatch.setenv("HOME", str(tmp_path))
@@ -418,7 +418,7 @@ def test_status_repos_workspace_filter_and_ndjson(
418418
expected_names: list[str],
419419
tmp_path: pathlib.Path,
420420
monkeypatch: MonkeyPatch,
421-
capsys: t.Any,
421+
capsys: pytest.CaptureFixture[str],
422422
) -> None:
423423
"""Test status workspace filtering and NDJSON output."""
424424
monkeypatch.setenv("HOME", str(tmp_path))
@@ -488,7 +488,7 @@ def test_status_repos_detailed_metrics(
488488
expected_behind: int,
489489
tmp_path: pathlib.Path,
490490
monkeypatch: MonkeyPatch,
491-
capsys: t.Any,
491+
capsys: pytest.CaptureFixture[str],
492492
) -> None:
493493
"""Detailed output includes branch and ahead/behind counters."""
494494
monkeypatch.setenv("HOME", str(tmp_path))
@@ -670,7 +670,7 @@ def tracked_check(repo: t.Any, detailed: bool = False) -> dict[str, t.Any]:
670670
def test_status_repos_concurrent_mode(
671671
tmp_path: pathlib.Path,
672672
monkeypatch: pytest.MonkeyPatch,
673-
capsys: t.Any,
673+
capsys: pytest.CaptureFixture[str],
674674
) -> None:
675675
"""Test status_repos with concurrent mode enabled."""
676676
monkeypatch.setenv("HOME", str(tmp_path))
@@ -713,7 +713,7 @@ def test_status_repos_concurrent_mode(
713713
def test_status_repos_sequential_mode(
714714
tmp_path: pathlib.Path,
715715
monkeypatch: pytest.MonkeyPatch,
716-
capsys: t.Any,
716+
capsys: pytest.CaptureFixture[str],
717717
) -> None:
718718
"""Test status_repos with sequential mode (no concurrency)."""
719719
monkeypatch.setenv("HOME", str(tmp_path))
@@ -752,7 +752,7 @@ def test_status_repos_sequential_mode(
752752
def test_status_repos_concurrent_json_output(
753753
tmp_path: pathlib.Path,
754754
monkeypatch: pytest.MonkeyPatch,
755-
capsys: t.Any,
755+
capsys: pytest.CaptureFixture[str],
756756
) -> None:
757757
"""Test that concurrent mode produces correct JSON output."""
758758
monkeypatch.setenv("HOME", str(tmp_path))
@@ -804,7 +804,7 @@ def test_status_repos_concurrent_json_output(
804804
def test_status_repos_concurrent_max_concurrent_limit(
805805
tmp_path: pathlib.Path,
806806
monkeypatch: pytest.MonkeyPatch,
807-
capsys: t.Any,
807+
capsys: pytest.CaptureFixture[str],
808808
) -> None:
809809
"""Test that max_concurrent parameter is respected."""
810810
monkeypatch.setenv("HOME", str(tmp_path))
@@ -888,7 +888,7 @@ def test_status_repos_path_contraction(
888888
detailed: bool,
889889
tmp_path: pathlib.Path,
890890
monkeypatch: pytest.MonkeyPatch,
891-
capsys: t.Any,
891+
capsys: pytest.CaptureFixture[str],
892892
) -> None:
893893
"""Test that status JSON/NDJSON output contracts home directory paths."""
894894
monkeypatch.setenv("HOME", str(tmp_path))

0 commit comments

Comments
 (0)