Skip to content
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

unittest TestCase shortDescription does not strip whitespace #83631

Closed
scirelli mannequin opened this issue Jan 25, 2020 · 6 comments
Closed

unittest TestCase shortDescription does not strip whitespace #83631

scirelli mannequin opened this issue Jan 25, 2020 · 6 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@scirelli
Copy link
Mannequin

scirelli mannequin commented Jan 25, 2020

BPO 39450
Nosy @cjw296, @cjerdonek, @scirelli, @iritkatriel
PRs
  • bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription #18175
  • [3.7] bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175) #18321
  • [3.8] bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175) #18322
  • [3.8] bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175) #18323
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-10-09.00:48:29.674>
    created_at = <Date 2020-01-25.01:03:33.456>
    labels = ['3.7', '3.8', 'type-feature', 'library']
    title = 'unittest TestCase shortDescription does not strip whitespace'
    updated_at = <Date 2020-10-09.00:48:29.664>
    user = 'https://github.com/scirelli'

    bugs.python.org fields:

    activity = <Date 2020-10-09.00:48:29.664>
    actor = 'chris.jerdonek'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-10-09.00:48:29.674>
    closer = 'chris.jerdonek'
    components = ['Library (Lib)']
    creation = <Date 2020-01-25.01:03:33.456>
    creator = 'scirelli'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39450
    keywords = ['patch']
    message_count = 6.0
    messages = ['360666', '361266', '361267', '361268', '378293', '378296']
    nosy_count = 4.0
    nosy_names = ['cjw296', 'chris.jerdonek', 'scirelli', 'iritkatriel']
    pr_nums = ['18175', '18321', '18322', '18323']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue39450'
    versions = ['Python 3.7', 'Python 3.8']

    @scirelli
    Copy link
    Mannequin Author

    scirelli mannequin commented Jan 25, 2020

    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.

    @scirelli scirelli mannequin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jan 25, 2020
    @cjw296
    Copy link
    Contributor

    cjw296 commented Feb 3, 2020

    New changeset 032de73 by Steve Cirelli in branch 'master':
    bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175)
    032de73

    @cjw296
    Copy link
    Contributor

    cjw296 commented Feb 3, 2020

    New changeset 7561e7a by Miss Islington (bot) in branch '3.7':
    bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18321)
    7561e7a

    @cjw296
    Copy link
    Contributor

    cjw296 commented Feb 3, 2020

    New changeset 02395fa by Miss Islington (bot) in branch '3.8':
    bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175) (bpo-18323)
    02395fa

    @iritkatriel
    Copy link
    Member

    This seems complete, can it be closed?

    @cjerdonek
    Copy link
    Member

    I believe this also resolves bpo-30181 (which was the same issue).

    @cjerdonek cjerdonek added the 3.8 only security fixes label Oct 9, 2020
    @cjerdonek cjerdonek added the 3.8 only security fixes label Oct 9, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants