Skip to content

Commit e5e3dc7

Browse files
simonfagerholmTinche
authored andcommitted
Added unittests for issue #154.
1 parent a7e5795 commit e5e3dc7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_simple.py

+23
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,29 @@ async def test_asyncio_marker_without_loop(self, remove_loop):
128128
assert ret == 'ok'
129129

130130

131+
class TestEventLoopStartedBeforeFixtures:
132+
@pytest.fixture
133+
async def loop(self):
134+
return asyncio.get_event_loop()
135+
136+
@staticmethod
137+
def foo():
138+
return 1
139+
140+
@pytest.mark.asyncio
141+
async def test_no_event_loop(self, loop):
142+
assert await loop.run_in_executor(None, self.foo) == 1
143+
144+
@pytest.mark.asyncio
145+
async def test_event_loop_after_fixture(self, loop, event_loop):
146+
assert await loop.run_in_executor(None, self.foo) == 1
147+
148+
@pytest.mark.asyncio
149+
async def test_event_loop_before_fixture(self, event_loop, loop):
150+
assert await loop.run_in_executor(None, self.foo) == 1
151+
152+
153+
131154
@pytest.mark.asyncio
132155
async def test_no_warning_on_skip():
133156
pytest.skip("Test a skip error inside asyncio")

0 commit comments

Comments
 (0)