Skip to content

Commit 70989fd

Browse files
seifertmTinche
authored andcommitted
refactor: Grouped test cases together that are related to the use of the asyncio marker in class-based tests.
Rephrased test names and comments to make the test intention more clear. Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
1 parent b27abe8 commit 70989fd

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/test_simple.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,18 @@ def mock_unused_tcp_port():
9999
assert unused_tcp_port_factory() > 10000
100100

101101

102-
class Test:
103-
"""Test that asyncio marked functions work in test methods."""
102+
class TestMarkerInClassBasedTests:
103+
"""Test that asyncio marked functions work for methods of test classes."""
104104

105105
@pytest.mark.asyncio
106-
async def test_asyncio_marker_method(self, event_loop):
107-
"""Test the asyncio pytest marker in a Test class."""
106+
async def test_asyncio_marker_with_explicit_loop_fixture(self, event_loop):
107+
"""Test the "asyncio" marker works on a method in a class-based test with explicit loop fixture."""
108108
ret = await async_coro()
109109
assert ret == "ok"
110110

111-
112-
class TestUnexistingLoop:
113111
@pytest.mark.asyncio
114-
async def test_asyncio_marker_without_loop(self):
115-
"""Test the asyncio pytest marker in a Test class."""
112+
async def test_asyncio_marker_with_implicit_loop_fixture(self):
113+
"""Test the "asyncio" marker works on a method in a class-based test with implicit loop fixture."""
116114
ret = await async_coro()
117115
assert ret == "ok"
118116

0 commit comments

Comments
 (0)