Skip to content

Commit

Permalink
refactor: Removed TestUnexistingLoop.remove_loop fixture, because it …
Browse files Browse the repository at this point in the history
…has no effect.

Under Python 3.10, the remove_loop fixture raises:
"DeprecationWarning: There is no current event loop"
This means that the remove_loop fixture effectively does nothing.

The test case is still kept, because it seemingly aims to test that the "asyncio" marker works inside test classes when no "event_loop" fixture is explicitly specified.

Signed-off-by: Michael Seifert <[email protected]>
  • Loading branch information
seifertm authored and Tinche committed May 30, 2021
1 parent e3ec312 commit b27abe8
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,8 @@ async def test_asyncio_marker_method(self, event_loop):


class TestUnexistingLoop:
@pytest.fixture
def remove_loop(self):
old_loop = asyncio.get_event_loop()
asyncio.set_event_loop(None)
yield
asyncio.set_event_loop(old_loop)

@pytest.mark.asyncio
async def test_asyncio_marker_without_loop(self, remove_loop):
async def test_asyncio_marker_without_loop(self):
"""Test the asyncio pytest marker in a Test class."""
ret = await async_coro()
assert ret == "ok"
Expand Down

0 comments on commit b27abe8

Please sign in to comment.