classification
Title: unittest TestCase shortDescription does not strip whitespace
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: cjw296, scirelli
Priority: normal Keywords: patch

Created on 2020-01-25 01:03 by scirelli, last changed 2020-02-03 08:20 by cjw296.

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 (4)
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
History
Date User Action Args
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