Skip to content

Commit 6b29eb8

Browse files
fix: Filter pytest-asyncio arguments in conftest.py
- Filter out event_loop and event_loop_policy arguments - Allow tests to work with both pytest-asyncio and plain async - Fixes TypeError when running async integration tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9dc0b1c commit 6b29eb8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ def pytest_pyfunc_call(pyfuncitem: pytest.Item) -> bool | None:
1313
"""Allow ``async def`` tests to run without pytest-asyncio."""
1414
test_func = getattr(pyfuncitem, "obj", None)
1515
if inspect.iscoroutinefunction(test_func):
16-
asyncio.run(test_func(**pyfuncitem.funcargs))
16+
# Filter out pytest-asyncio specific arguments
17+
funcargs = {
18+
k: v for k, v in pyfuncitem.funcargs.items()
19+
if k not in ('event_loop', 'event_loop_policy')
20+
}
21+
asyncio.run(test_func(**funcargs))
1722
return True
1823
return None

0 commit comments

Comments
 (0)