File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -499,3 +499,32 @@ async def test_b(shared_fixture):
499499 # https://github.com/willemt/pytest-asyncio-cooperative/issues/42
500500 else :
501501 result .assert_outcomes (passed = 2 )
502+
503+
504+ def test_teardown_on_fixture_error (testdir ):
505+ testdir .makepyfile (
506+ """
507+ import pytest
508+
509+ import asyncio
510+ from warnings import warn
511+
512+ @pytest.fixture
513+ async def fixture_ok():
514+ await asyncio.sleep(1)
515+ yield
516+ warn("fixture_ok teardown")
517+
518+ @pytest.fixture
519+ async def fixture_fail():
520+ await asyncio.sleep(2)
521+ assert False
522+
523+ @pytest.mark.asyncio_cooperative
524+ async def test(fixture_ok, fixture_fail):
525+ assert True
526+ """
527+ )
528+
529+ with pytest .warns (UserWarning , match = "fixture_ok teardown" ):
530+ result = testdir .runpytest ()
You can’t perform that action at this time.
0 commit comments