cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-91289: Reformat the text output of unittest

Open ziima opened this issue 1 year ago • 1 comments

Fixed at EuroPython 24 sprints.

Based on the discussions at #91289 and EuroPython 24 sprints, I reformatted the text output of unittests to a single line for each test.

Example output:

This is an error docstring. (test_docstring.Foo.test_error) ... ERROR
test_docstring.Foo.test_error_no_doc ... ERROR
This is OK docstring. (test_docstring.Foo.test_ok) ... ok
test_docstring.Foo.test_ok_no_doc ... ok

======================================================================
ERROR: This is an error docstring. (test_docstring.Foo.test_error)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/pokus_unittest/test_docstring.py", line 9, in test_error
    raise Exception('Gazpacho!')
Exception: Gazpacho!

======================================================================
ERROR: test_docstring.Foo.test_error_no_doc
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/pokus_unittest/test_docstring.py", line 26, in test_error_no_doc
    raise Exception('Gazpacho!')
Exception: Gazpacho!

----------------------------------------------------------------------
Ran 4 tests in 0.004s

FAILED (errors=2)

The line contains docstring if conditions are met and removes the duplicate name of test method. It produces longer lines, but I think this is acceptable

Closes #91289

  • Issue: gh-91289

ziima avatar Jul 13 '24 14:07 ziima

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

bedevere-app[bot] avatar Jul 14 '24 22:07 bedevere-app[bot]