This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unittest TestCase shortDescription does not strip whitespace
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: chris.jerdonek, cjw296, iritkatriel, scirelli
Priority: normal Keywords: patch

Created on 2020-01-25 01:03 by scirelli, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18175 merged scirelli, 2020-01-25 01:33
PR 18321 merged miss-islington, 2020-02-03 07:07
PR 18322 closed miss-islington, 2020-02-03 07:07
PR 18323 merged miss-islington, 2020-02-03 08:03
Messages (6)
msg360666 - (view) Author: scirelli (scirelli) * Date: 2020-01-25 01:03
When running unit tests with the --verbose flag test descriptions are run using the first line of the test case's docstring. If the first character of the docstring is a newline, no description is printed.
Examples:
Current code expects docstrings to look like
'''It should return blah blah
This is a test...
'''
Where the description starts on the first line.

Some Python developers start the string on the next line. Example:
'''
It should return blah blah
This is a test...
'''

Lib.unittest.case.TestCase:shortDescription should first strip the docstrip of beginning and trailing whitespace.
msg361266 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2020-02-03 07:06
New changeset 032de7324e30c6b44ef272cea3be205a3d768759 by Steve Cirelli in branch 'master':
bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175)
https://github.com/python/cpython/commit/032de7324e30c6b44ef272cea3be205a3d768759
msg361267 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2020-02-03 07:25
New changeset 7561e7a83ccccf5118fda6c62fe9c8c3458f8cfd by Miss Islington (bot) in branch '3.7':
bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18321)
https://github.com/python/cpython/commit/7561e7a83ccccf5118fda6c62fe9c8c3458f8cfd
msg361268 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2020-02-03 08:20
New changeset 02395fad8e3a35ef00fa31c308693844013a1dd4 by Miss Islington (bot) in branch '3.8':
bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175) (#18323)
https://github.com/python/cpython/commit/02395fad8e3a35ef00fa31c308693844013a1dd4
msg378293 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-10-08 23:29
This seems complete, can it be closed?
msg378296 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2020-10-09 00:48
I believe this also resolves issue 30181 (which was the same issue).
History
Date User Action Args
2022-04-11 14:59:25adminsetgithub: 83631
2020-10-25 21:47:01chris.jerdoneklinkissue30181 superseder
2020-10-09 00:48:29chris.jerdoneksetstatus: open -> closed

versions: + Python 3.8
nosy: + chris.jerdonek

messages: + msg378296
resolution: fixed
stage: patch review -> resolved
2020-10-08 23:29:59iritkatrielsetnosy: + iritkatriel
messages: + msg378293
2020-02-03 08:20:48cjw296setmessages: + msg361268
2020-02-03 08:03:02miss-islingtonsetpull_requests: + pull_request17696
2020-02-03 07:25:23cjw296setmessages: + msg361267
2020-02-03 07:07:29miss-islingtonsetpull_requests: + pull_request17695
2020-02-03 07:07:21miss-islingtonsetpull_requests: + pull_request17694
2020-02-03 07:06:57cjw296setnosy: + cjw296
messages: + msg361266
2020-01-25 01:33:39scirellisetkeywords: + patch
stage: patch review
pull_requests: + pull_request17559
2020-01-25 01:03:33scirellicreate