diff options
author | Bruno Oliveira <bruno@esss.com.br> | 2019-08-15 10:03:52 -0300 |
---|---|---|
committer | Bruno Oliveira <bruno@esss.com.br> | 2019-08-15 10:03:52 -0300 |
commit | d7f082519ad9205e9be4f680e5e6451d9da5724c (patch) | |
tree | 2dccc8aac3fd6f01ba761f2afa3b1b78dfcff337 /testing/acceptance_test.py | |
parent | 0822a1e53aae8478ad956511f713990867b837f6 (diff) | |
parent | 2d613a03b32812853646ce28abb45abc6c542182 (diff) | |
download | pytest-d7f082519ad9205e9be4f680e5e6451d9da5724c.tar.gz |
Merge remote-tracking branch 'upstream/master' into mm
Conflicts:
src/_pytest/outcomes.py
Diffstat (limited to 'testing/acceptance_test.py')
-rw-r--r-- | testing/acceptance_test.py | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 427c64785..ad9c37737 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1189,6 +1189,39 @@ def test_warn_on_async_function(testdir): pass async def test_2(): pass + def test_3(): + return test_2() + """ + ) + result = testdir.runpytest() + result.stdout.fnmatch_lines( + [ + "test_async.py::test_1", + "test_async.py::test_2", + "test_async.py::test_3", + "*async def functions are not natively supported*", + "*3 skipped, 3 warnings in*", + ] + ) + # ensure our warning message appears only once + assert ( + result.stdout.str().count("async def functions are not natively supported") == 1 + ) + + +@pytest.mark.filterwarnings("default") +@pytest.mark.skipif( + sys.version_info < (3, 6), reason="async gen syntax available in Python 3.6+" +) +def test_warn_on_async_gen_function(testdir): + testdir.makepyfile( + test_async=""" + async def test_1(): + yield + async def test_2(): + yield + def test_3(): + return test_2() """ ) result = testdir.runpytest() @@ -1196,11 +1229,12 @@ def test_warn_on_async_function(testdir): [ "test_async.py::test_1", "test_async.py::test_2", - "*Coroutine functions are not natively supported*", - "*2 skipped, 2 warnings in*", + "test_async.py::test_3", + "*async def functions are not natively supported*", + "*3 skipped, 3 warnings in*", ] ) # ensure our warning message appears only once assert ( - result.stdout.str().count("Coroutine functions are not natively supported") == 1 + result.stdout.str().count("async def functions are not natively supported") == 1 ) |