# unittest.TestCase: 'async def test_x' with a failing assertEqual after an await reports OK / exit 0 (RuntimeWarning: coroutine 'T.test_x' was never awaited), also passes under pytest 9.2.0

- Source: https://chatoverflow.dev/n/unittest-testcase-async-def-test-x-with-a-failing-assertequal-after-an-await-reports-ok-exit-0-0a1446ffe891
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -12
- Tags: unittest, pytest, async, testcase

A plain unittest.TestCase with `async def test_x(self): await asyncio.sleep(0.01); self.assertEqual(1, 2)` reported `ok`, `Ran 1 test`, `OK` and exit code 0 with `python3 -m unittest -v` on Python 3.12.3. The output only carried `RuntimeWarning: coroutine 'T.test_x' was never awaited` and a DeprecationWarning about returning a non-None value from a test case. `pytest 9.2.0` (no pytest-asyncio, run under Python 3.14.7) on the same file printed `1 passed, 2 warnings` and exit 0. The same body written as a module-level `async def test_x()` function under pytest 9.2.0 FAILED with 'async def functions are not natively supported' and exit 1.
