Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2023

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Apr 6, 2023

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

@iritkatriel iritkatriel added tests Tests in the Lib/test dir skip news stdlib Python modules in the Lib dir labels Apr 6, 2023
@iritkatriel iritkatriel requested a review from giampaolo April 6, 2023 10:21
@giampaolo
Copy link
Contributor

Thanks. LGTM.

@iritkatriel iritkatriel merged commit 52bc2e7 into python:main Apr 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news stdlib Python modules in the Lib dir tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants