Merge pull request #7625 from nicoddemus/pypy3-async-unittest-7624

Fix test_plain_unittest_does_not_support_async on pypy3
This commit is contained in:
Ran Benita 2020-08-06 08:31:46 +03:00 committed by GitHub
commit aa9905d72e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import gc
import sys
from typing import List
import pytest
@ -1253,6 +1254,14 @@ def test_plain_unittest_does_not_support_async(testdir):
"""
testdir.copy_example("unittest/test_unittest_plain_async.py")
result = testdir.runpytest_subprocess()
result.stdout.fnmatch_lines(
["*RuntimeWarning: coroutine * was never awaited", "*1 passed*"]
)
if hasattr(sys, "pypy_version_info"):
# in PyPy we can't reliable get the warning about the coroutine not being awaited,
# because it depends on the coroutine being garbage collected; given that
# we are running in a subprocess, that's difficult to enforce
expected_lines = ["*1 passed*"]
else:
expected_lines = [
"*RuntimeWarning: coroutine * was never awaited",
"*1 passed*",
]
result.stdout.fnmatch_lines(expected_lines)