Closed
Description
In v0.17.1
the pytest_runtest_setup
function was modified from:
...
if (
item.get_closest_marker("asyncio") is not None
and not getattr(item.obj, "hypothesis", False)
and getattr(item.obj, "is_hypothesis_test", False)
):
...
To this:
...
obj = item.obj # type: ignore[attr-defined]
if (
item.get_closest_marker("asyncio") is not None
and not getattr(obj, "hypothesis", False)
and getattr(obj, "is_hypothesis_test", False)
):
...
Which will then cause an error when non-python test items are collected, for example this CI run: https://github.com/RobertCraigie/prisma-client-py/runs/4835031754?check_suite_focus=true
item = <PyrightTestItem count.py>
def pytest_runtest_setup(item: pytest.Item) -> None:
if "asyncio" in item.keywords:
fixturenames = item.fixturenames # type: ignore[attr-defined]
# inject an event loop fixture for all async tests
if "event_loop" in fixturenames:
fixturenames.remove("event_loop")
fixturenames.insert(0, "event_loop")
> obj = item.obj # type: ignore[attr-defined]
E AttributeError: 'PyrightTestItem' object has no attribute 'obj'
/tmp/tox/prisma-client-py/typesafety-pyright/lib/python3.9/site-packages/pytest_asyncio/plugin.py:450: AttributeError
It should be noted that these custom pytest items have no interaction with pytest-asyncio
, they are simply collected while the pytest-asyncio
plugin is installed.
Metadata
Metadata
Assignees
Labels
No labels