Skip to content

Commit 5c38be6

Browse files
committed
warn about async def rather than coroutine
1 parent b4839b8 commit 5c38be6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/_pytest/python.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ def pytest_configure(config):
153153
def pytest_pyfunc_call(pyfuncitem):
154154
testfunction = pyfuncitem.obj
155155
if iscoroutinefunction(testfunction):
156-
msg = "Coroutine functions are not natively supported and have been skipped.\n"
156+
msg = "async def functions are not natively supported and have been skipped.\n"
157157
msg += "You need to install a suitable plugin for your async framework, for example:\n"
158158
msg += " - pytest-asyncio\n"
159159
msg += " - pytest-trio\n"
160160
msg += " - pytest-tornasync"
161161
warnings.warn(PytestUnhandledCoroutineWarning(msg.format(pyfuncitem.nodeid)))
162-
skip(msg="coroutine function and no async plugin installed (see warnings)")
162+
skip(msg="async def function and no async plugin installed (see warnings)")
163163
funcargs = pyfuncitem.funcargs
164164
testargs = {arg: funcargs[arg] for arg in pyfuncitem._fixtureinfo.argnames}
165165
testfunction(**testargs)

testing/acceptance_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,11 +1199,11 @@ async def test_2():
11991199
[
12001200
"test_async.py::test_1",
12011201
"test_async.py::test_2",
1202-
"*Coroutine functions are not natively supported*",
1202+
"*async def functions are not natively supported*",
12031203
"*2 skipped, 2 warnings in*",
12041204
]
12051205
)
12061206
# ensure our warning message appears only once
12071207
assert (
1208-
result.stdout.str().count("Coroutine functions are not natively supported") == 1
1208+
result.stdout.str().count("async def functions are not natively supported") == 1
12091209
)

0 commit comments

Comments
 (0)