Skip to content

Commit 67cb7ef

Browse files
committed
Fix test_plain_unittest_does_not_support_async on pypy3
Fix #7624
1 parent a64298f commit 67cb7ef

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

testing/test_unittest.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import gc
2+
import sys
23
from typing import List
34

45
import pytest
@@ -1253,6 +1254,14 @@ def test_plain_unittest_does_not_support_async(testdir):
12531254
"""
12541255
testdir.copy_example("unittest/test_unittest_plain_async.py")
12551256
result = testdir.runpytest_subprocess()
1256-
result.stdout.fnmatch_lines(
1257-
["*RuntimeWarning: coroutine * was never awaited", "*1 passed*"]
1258-
)
1257+
if hasattr(sys, "pypy_version_info"):
1258+
# in PyPy we can't reliable get the warning about the coroutine not being awaited,
1259+
# because it depends on the coroutine being garbage collected; given that
1260+
# we are running in a subprocess, that's difficult to enforce
1261+
expected_lines = ["*1 passed*"]
1262+
else:
1263+
expected_lines = [
1264+
"*RuntimeWarning: coroutine * was never awaited",
1265+
"*1 passed*",
1266+
]
1267+
result.stdout.fnmatch_lines(expected_lines)

0 commit comments

Comments
 (0)