Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/navi_bootstrap/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def detect_test_info(target: Path) -> dict[str, Any]:
content = test_file.read_text(errors="replace")
except (PermissionError, OSError):
continue
count += len(re.findall(r"^\s*def test_", content, re.MULTILINE))
count += len(re.findall(r"^\s*(?:async\s+)?def test_", content, re.MULTILINE))
Comment thread
Fieldnote-Echo marked this conversation as resolved.

return {
"test_framework": "pytest",
Expand Down
11 changes: 10 additions & 1 deletion tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,16 @@ def test_ignores_non_test_files(self, tmp_path: Path) -> None:
result = detect_test_info(tmp_path)
assert result["test_count"] == 1


def test_detects_async_test_functions(self, tmp_path: Path) -> None:
tests = tmp_path / "tests"
tests.mkdir()
test_file = tests / "test_example.py"
test_file.write_text(
"def test_sync(): pass\n"
"async def test_async(): pass\n"
)
result = detect_test_info(tmp_path)
assert result["test_count"] == 2
# ---------------------------------------------------------------------------
# TestInspectProject
# ---------------------------------------------------------------------------
Expand Down
Loading