◐ Shell
clean mode source ↗

gh-92886: Fix test in `test_routines.py` so that it works when running with optimizations (`-O`) by jackh-ncl · Pull Request #93232 · python/cpython

$ ./python.exe -Om unittest test.test_coroutines

........................./Users/.../dev/cpython/Lib/test/test_coroutines.py:2207: RuntimeWarning: coroutine 'CoroutineTest.test_bpo_45813_2.<locals>.f' was never awaited
  with self.assertWarns(RuntimeWarning):
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
............................................................F.........
======================================================================
FAIL: test_with_5 (test.test_coroutines.CoroutineTest.test_with_5)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/.../dev/cpython/Lib/test/test_coroutines.py", line 1284, in test_with_5
    with self.assertRaises(AssertionError):
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: AssertionError not raised

----------------------------------------------------------------------
Ran 95 tests in 0.323s

FAILED (failures=1)
$ ./python.exe -Om unittest test.test_coroutines

........................./Users/jackhindmarch/dev/cpython/Lib/test/test_coroutines.py:2207: RuntimeWarning: coroutine 'CoroutineTest.test_bpo_45813_2.<locals>.f' was never awaited
  with self.assertWarns(RuntimeWarning):
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
......................................................................
----------------------------------------------------------------------
Ran 95 tests in 0.325s

OK