Merge pull request #6927 from RonnyPfannschmidt/fix-6924-run-async-stdlib-unittests
running stdlib asyncio unittests again
This commit is contained in:
2
testing/example_scripts/pytest.ini
Normal file
2
testing/example_scripts/pytest.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
# dummy pytest.ini to ease direct running of example scripts
|
||||
15
testing/example_scripts/unittest/test_unittest_asyncio.py
Normal file
15
testing/example_scripts/unittest/test_unittest_asyncio.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from unittest import IsolatedAsyncioTestCase # type: ignore
|
||||
|
||||
|
||||
class AsyncArguments(IsolatedAsyncioTestCase):
|
||||
async def test_something_async(self):
|
||||
async def addition(x, y):
|
||||
return x + y
|
||||
|
||||
self.assertEqual(await addition(2, 2), 4)
|
||||
|
||||
async def test_something_async_fails(self):
|
||||
async def addition(x, y):
|
||||
return x + y
|
||||
|
||||
self.assertEqual(await addition(2, 2), 3)
|
||||
@@ -1129,3 +1129,11 @@ def test_trace(testdir, monkeypatch):
|
||||
result = testdir.runpytest("--trace", str(p1))
|
||||
assert len(calls) == 2
|
||||
assert result.ret == 0
|
||||
|
||||
|
||||
def test_async_support(testdir):
|
||||
pytest.importorskip("unittest.async_case")
|
||||
|
||||
testdir.copy_example("unittest/test_unittest_asyncio.py")
|
||||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(failed=1, passed=1)
|
||||
|
||||
Reference in New Issue
Block a user