Skip to content

gh-92886: Fix test in test_routines.py so that it works when running with optimizations (-O) - #93232

Closed
jackh-ncl wants to merge 4 commits into
python:mainfrom
jackh-ncl:92886-coroutines
Closed

gh-92886: Fix test in test_routines.py so that it works when running with optimizations (-O)#93232
jackh-ncl wants to merge 4 commits into
python:mainfrom
jackh-ncl:92886-coroutines

Conversation

@jackh-ncl

@jackh-ncljackh-ncl commented May 25, 2022

Copy link
Copy Markdown
Contributor

#92886

Before:

$ ./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)

After:

$ ./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

@bedevere-bot

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@bedevere-botbedevere-bot added tests Tests in the Lib/test dir awaiting review labels May 25, 2022
@jackh-ncl
jackh-ncl marked this pull request as ready for review May 25, 2022 22:23
@kumaraditya303

Copy link
Copy Markdown
Contributor

News entry is not required, you can remove it.

@jackh-ncl

Copy link
Copy Markdown
ContributorAuthor

News entry is not required, you can remove it.

done

@JelleZijlstra

Copy link
Copy Markdown
Member

@iritkatriel made this same change already in #98060.

@iritkatriel

Copy link
Copy Markdown
Member

Sorry, I didn't see this.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core reviewskip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@jackh-ncl@bedevere-bot@kumaraditya303@JelleZijlstra@iritkatriel