pytest-asyncio icon indicating copy to clipboard operation
pytest-asyncio copied to clipboard

test that mark.asyncio scope is respected

Open minrk opened this issue 1 year ago • 1 comments

test case for tangential issue discovered trying to provide an example use case for #706.

When a function-scoped async fixture is used, @pytest.mark.asyncio(scope="module") on tests is ignored. Notably, when the function-scoped fixture is used in any test, the scope="module" is ignored. So test_module_loop passes if it is the only test, but if either of the other two tests are enabled, test_module_loop will fail without modification. test_module_loop_function_fixture always fails.

Draft because this only adds a failing test. I don't think I have the expertise to actually fix the behavior, but hopefully the test case can help someone make sure it's fixed.

minrk avatar Jan 31 '24 12:01 minrk

Thanks for the example! I haven't looked at it in detail, yet, but it could be related to #868 .

seifertm avatar Jul 13 '24 13:07 seifertm