-
Notifications
You must be signed in to change notification settings - Fork 2
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Problem
The project inspector in src/navi_bootstrap/init.py (line 252) counts test functions using:
count += len(re.findall(r"^\s*def test_", content, re.MULTILINE))This misses async def test_* functions, undercounting the test suite for projects that use async tests (e.g. with pytest-asyncio).
Fix
Update the regex to match both sync and async test functions:
count += len(re.findall(r"^\s*(?:async\s+)?def test_", content, re.MULTILINE))Tests
Add a test that creates a temporary file containing both sync and async test functions and verifies the count includes both:
def test_detect_async_tests(tmp_path):
test_file = tmp_path / "tests" / "test_example.py"
test_file.parent.mkdir()
test_file.write_text(
"def test_sync(): pass\n"
"async def test_async(): pass\n"
)
info = detect_test_info(tmp_path)
assert info["test_count"] == 2Files to change
src/navi_bootstrap/init.py(line 252)tests/test_init.py
Ref
DEBT.md item D1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers