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

Add helper to check that no ResourceWarning is emitted #70513

Closed
serhiy-storchaka opened this issue Feb 10, 2016 · 6 comments
Closed

Add helper to check that no ResourceWarning is emitted #70513

serhiy-storchaka opened this issue Feb 10, 2016 · 6 comments
Assignees
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 26325
Nosy @vstinner, @vadmium, @serhiy-storchaka
Files
  • test_support_check_no_resource_warning.patch
  • test_support_check_no_resource_warning_2.patch
  • 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 = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-02-11.11:38:28.887>
    created_at = <Date 2016-02-10.10:14:02.054>
    labels = ['type-feature', 'tests']
    title = 'Add helper to check that no ResourceWarning is emitted'
    updated_at = <Date 2016-02-11.11:38:28.886>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2016-02-11.11:38:28.886>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-02-11.11:38:28.887>
    closer = 'serhiy.storchaka'
    components = ['Tests']
    creation = <Date 2016-02-10.10:14:02.054>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['41883', '41885']
    hgrepos = []
    issue_num = 26325
    keywords = ['patch']
    message_count = 6.0
    messages = ['260000', '260001', '260002', '260005', '260040', '260086']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'python-dev', 'martin.panter', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue26325'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6']

    @serhiy-storchaka
    Copy link
    Member Author

    Victor proposed in bpo-25994 to use special context manager to check that no ResourceWarning is emitted. I think that this helper can be useful in other tests. It saves 3 lines for every use. Proposed patch adds it in test.support.

    @serhiy-storchaka serhiy-storchaka added tests Tests in the Lib/test dir type-feature A feature request or enhancement labels Feb 10, 2016
    @vstinner
    Copy link
    Member

    Oh, I didn't expect that so many existing test already use the same pattern to check for ResourceWarning. Nice patch!

    I added a comment: we must be careful in the documentation of the helper.

    @vadmium
    Copy link
    Member

    vadmium commented Feb 10, 2016

    I was about to suggest adding this to test.support as well. Patch looks good to me.

    @serhiy-storchaka
    Copy link
    Member Author

    Addressed Victor's comments.

    This pattern is not widely used. Usually only raising ResourceWarning is tested, but not non-raising.

    @vstinner
    Copy link
    Member

    test_support_check_no_resource_warning_2.patch LGTM, thanks.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 11, 2016

    New changeset e9a4b30e3e43 by Serhiy Storchaka in branch '3.5':
    Issue bpo-26325: Added test.support.check_no_resource_warning() to check that
    https://hg.python.org/cpython/rev/e9a4b30e3e43

    New changeset faf676d8c054 by Serhiy Storchaka in branch 'default':
    Issue bpo-26325: Added test.support.check_no_resource_warning() to check that
    https://hg.python.org/cpython/rev/faf676d8c054

    @serhiy-storchaka serhiy-storchaka self-assigned this Feb 11, 2016
    @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
    tests Tests in the Lib/test dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants