Skip to content

gh-48330: assert warning is emitted on unittest.TestResult with no addDuration - #103309

Merged
iritkatriel merged 1 commit into
python:mainfrom
iritkatriel:warning
Apr 6, 2023
Merged

gh-48330: assert warning is emitted on unittest.TestResult with no addDuration#103309
iritkatriel merged 1 commit into
python:mainfrom
iritkatriel:warning

Conversation

@iritkatriel

@iritkatrieliritkatriel commented Apr 6, 2023

Copy link
Copy Markdown
Member

Fixes the warning below, which started with #12271.

======================================================================
ERROR: test_run_call_order_default_result (test.test_unittest.test_case.Test_TestCase.test_run_call_order_default_result)
----------------------------------------------------------------------
AttributeError: 'ResultWithNoStartTestRunStopTestRun' object has no attribute 'addDuration'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/iritkatriel/src/cpython/Lib/test/test_unittest/test_case.py", line 307, in test_run_call_order_default_result
Foo('test').run()
File "/Users/iritkatriel/src/cpython/Lib/unittest/case.py", line 639, in run
self._addDuration(result, (time.perf_counter() - start_time))
File "/Users/iritkatriel/src/cpython/Lib/unittest/case.py", line 580, in _addDuration
warnings.warn("TestResult has no addDuration method",
RuntimeWarning: TestResult has no addDuration method

@iritkatrieliritkatriel added tests Tests in the Lib/test dir skip news stdlib Standard Library Python modules in the Lib/ directory labels Apr 6, 2023
@giampaolo

Copy link
Copy Markdown
Contributor

Thanks. LGTM.

@iritkatriel
iritkatriel merged commit 52bc2e7 into python:mainApr 6, 2023
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
hrnciar pushed a commit to fedora-python/cpython that referenced this pull request Apr 12, 2023
@iritkatriel
iritkatriel deleted the warning branch July 25, 2023 18:05
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newsstdlibStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@iritkatriel@giampaolo@bedevere-bot