You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that the pytest-asyncio 0.23 broke class-scoped fixtures defined outside of the class. Namely, I used to have the following setup:
conftest.py:
@pytest_asyncio.fixture(scope="class")asyncdefrun_important_program_in_class() ->AsyncGenerator[ImportantProgram, None]:
"""runs one Program instance per test class"""asyncwithrun_important_program(cfg=generate_cfg()) asp:
yieldp
and then the test classes used @pytest.mark.usefixtures("run_important_program_in_class")
however with upgrade to 0.23, now the following error being reported:
ERROR my_example_test.py - _pytest.config.exceptions.UsageError: my_example_test.py is marked to be run i
n an event loop with scope class, but is not part of any class
The error disappears of the fixture is moved to the class definition, like this:
It appears that the pytest-asyncio 0.23 broke class-scoped fixtures defined outside of the class. Namely, I used to have the following setup:
conftest.py:
and then the test classes used
@pytest.mark.usefixtures("run_important_program_in_class")
however with upgrade to 0.23, now the following error being reported:
The error disappears of the fixture is moved to the class definition, like this:
But this approach leads to significant code duplication
The text was updated successfully, but these errors were encountered: