summaryrefslogtreecommitdiff
path: root/testing/test_unittest.py
diff options
context:
space:
mode:
authorBruno Oliveira <nicoddemus@gmail.com>2020-08-05 15:24:08 -0300
committerBruno Oliveira <nicoddemus@gmail.com>2020-08-05 15:24:08 -0300
commit67cb7ef673733628c2076a448806a78e64b274e4 (patch)
tree05f900a4ea874ba356e963a631722b0a33e70ef3 /testing/test_unittest.py
parenta64298ff5e4d965b227e412c27677337f08a6ac4 (diff)
downloadpytest-67cb7ef673733628c2076a448806a78e64b274e4.tar.gz
Fix test_plain_unittest_does_not_support_async on pypy3
Fix #7624
Diffstat (limited to 'testing/test_unittest.py')
-rw-r--r--testing/test_unittest.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/testing/test_unittest.py b/testing/test_unittest.py
index 26fbf41cf..c7b6bfcec 100644
--- a/testing/test_unittest.py
+++ b/testing/test_unittest.py
@@ -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)