MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_warn_on_async_gen_function

Function test_warn_on_async_gen_function

testing/acceptance_test.py:1187–1211  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

1185
1186@pytest.mark.filterwarnings("default::pytest.PytestUnhandledCoroutineWarning")
1187def test_warn_on_async_gen_function(pytester: Pytester) -> None:
1188 pytester.makepyfile(
1189 test_async="""
1190 async def test_1():
1191 yield
1192 async def test_2():
1193 yield
1194 def test_3():
1195 return test_2()
1196 """
1197 )
1198 result = pytester.runpytest()
1199 result.stdout.fnmatch_lines(
1200 [
1201 "test_async.py::test_1",
1202 "test_async.py::test_2",
1203 "test_async.py::test_3",
1204 "*async def functions are not natively supported*",
1205 "*3 skipped, 3 warnings in*",
1206 ]
1207 )
1208 # ensure our warning message appears only once
1209 assert (
1210 result.stdout.str().count("async def functions are not natively supported") == 1
1211 )
1212
1213
1214def test_pdb_can_be_rewritten(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 5

fnmatch_linesMethod · 0.80
countMethod · 0.80
strMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected