File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ import unittest
2
+
3
+
4
+ class Test (unittest .TestCase ):
5
+ async def test_foo (self ):
6
+ assert False
Original file line number Diff line number Diff line change @@ -1241,3 +1241,18 @@ def test_asynctest_support(testdir):
1241
1241
testdir .copy_example ("unittest/test_unittest_asynctest.py" )
1242
1242
reprec = testdir .inline_run ()
1243
1243
reprec .assertoutcome (failed = 1 , passed = 2 )
1244
+
1245
+
1246
+ def test_plain_unittest_does_not_support_async (testdir ):
1247
+ """Async functions in plain unittest.TestCase subclasses are not supported without plugins.
1248
+
1249
+ This test exists here to avoid introducing this support by accident, leading users
1250
+ to expect that it works, rather than doing so intentionally as a feature.
1251
+
1252
+ See https://github.com/pytest-dev/pytest-asyncio/issues/180 for more context.
1253
+ """
1254
+ testdir .copy_example ("unittest/test_unittest_plain_async.py" )
1255
+ result = testdir .runpytest_subprocess ()
1256
+ result .stdout .fnmatch_lines (
1257
+ ["*RuntimeWarning: coroutine * was never awaited" , "*1 passed*" ]
1258
+ )
You can’t perform that action at this time.
0 commit comments