also warn on awaitable or async iterable test results

This commit is contained in:
Thomas Grainger
2019-08-15 12:03:06 +01:00
parent 0ba774a7c3
commit 6b9d729ed3
2 changed files with 18 additions and 7 deletions
+8 -2
View File
@@ -1192,6 +1192,8 @@ def test_warn_on_async_function(testdir):
pass
async def test_2():
pass
def test_3():
return test_2()
"""
)
result = testdir.runpytest()
@@ -1199,8 +1201,9 @@ def test_warn_on_async_function(testdir):
[
"test_async.py::test_1",
"test_async.py::test_2",
"test_async.py::test_3",
"*async def functions are not natively supported*",
"*2 skipped, 2 warnings in*",
"*3 skipped, 3 warnings in*",
]
)
# ensure our warning message appears only once
@@ -1220,6 +1223,8 @@ def test_warn_on_async_gen_function(testdir):
yield
async def test_2():
yield
def test_3():
return test_2()
"""
)
result = testdir.runpytest()
@@ -1227,8 +1232,9 @@ def test_warn_on_async_gen_function(testdir):
[
"test_async.py::test_1",
"test_async.py::test_2",
"test_async.py::test_3",
"*async def functions are not natively supported*",
"*2 skipped, 2 warnings in*",
"*3 skipped, 3 warnings in*",
]
)
# ensure our warning message appears only once