@@ -494,6 +494,64 @@ def test_second(foo):
494494 assert_outcomes (rr , {"passed" : 2 })
495495
496496
497+ @skip_if_no_async_await ()
498+ def test_async_simple_fixture_in_fixture (testdir , cmd_opts ):
499+ test_file = """
500+ import itertools
501+ from twisted.internet import reactor, defer
502+ import pytest
503+ import pytest_twisted
504+
505+ @pytest_twisted.async_fixture(name='four')
506+ async def fixture_four():
507+ return 4
508+
509+ @pytest_twisted.async_fixture(name='doublefour')
510+ async def fixture_doublefour(four):
511+ return 2 * four
512+
513+ @pytest_twisted.ensureDeferred
514+ async def test_four(four):
515+ assert four == 4
516+
517+ @pytest_twisted.ensureDeferred
518+ async def test_doublefour(doublefour):
519+ assert doublefour == 8
520+ """
521+ testdir .makepyfile (test_file )
522+ rr = testdir .run (sys .executable , "-m" , "pytest" , "-v" , * cmd_opts )
523+ assert_outcomes (rr , {"passed" : 2 })
524+
525+
526+ @skip_if_no_async_generators ()
527+ def test_async_yield_simple_fixture_in_fixture (testdir , cmd_opts ):
528+ test_file = """
529+ import itertools
530+ from twisted.internet import reactor, defer
531+ import pytest
532+ import pytest_twisted
533+
534+ @pytest_twisted.async_yield_fixture(name='four')
535+ async def fixture_four():
536+ yield 4
537+
538+ @pytest_twisted.async_yield_fixture(name='doublefour')
539+ async def fixture_doublefour(four):
540+ yield 2 * four
541+
542+ @pytest_twisted.ensureDeferred
543+ async def test_four(four):
544+ assert four == 4
545+
546+ @pytest_twisted.ensureDeferred
547+ async def test_doublefour(doublefour):
548+ assert doublefour == 8
549+ """
550+ testdir .makepyfile (test_file )
551+ rr = testdir .run (sys .executable , "-m" , "pytest" , "-v" , * cmd_opts )
552+ assert_outcomes (rr , {"passed" : 2 })
553+
554+
497555@skip_if_no_async_await ()
498556@pytest .mark .parametrize ('innerasync' , [
499557 pytest .param (truth , id = 'innerasync={}' .format (truth ))
0 commit comments