Skip to content

Commit

Permalink
Added unittests for issue #154.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonfagerholm authored and Tinche committed May 3, 2020
1 parent a7e5795 commit e5e3dc7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_simple.py
Expand Up @@ -128,6 +128,29 @@ async def test_asyncio_marker_without_loop(self, remove_loop):
assert ret == 'ok'


class TestEventLoopStartedBeforeFixtures:
@pytest.fixture
async def loop(self):
return asyncio.get_event_loop()

@staticmethod
def foo():
return 1

@pytest.mark.asyncio
async def test_no_event_loop(self, loop):
assert await loop.run_in_executor(None, self.foo) == 1

@pytest.mark.asyncio
async def test_event_loop_after_fixture(self, loop, event_loop):
assert await loop.run_in_executor(None, self.foo) == 1

@pytest.mark.asyncio
async def test_event_loop_before_fixture(self, event_loop, loop):
assert await loop.run_in_executor(None, self.foo) == 1



@pytest.mark.asyncio
async def test_no_warning_on_skip():
pytest.skip("Test a skip error inside asyncio")

0 comments on commit e5e3dc7

Please sign in to comment.