Issue 26325: Add helper to check that no ResourceWarning is emitted (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/70513

classification

Title: Add helper to check that no ResourceWarning is emitted
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.6, Python 3.5, Python 2.7

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: martin.panter, python-dev, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2016-02-10 10:14 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_support_check_no_resource_warning.patch serhiy.storchaka,2016-02-10 10:14 review
test_support_check_no_resource_warning_2.patch serhiy.storchaka,2016-02-10 11:13 review
Messages (6)
msg260000 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-10 10:14
Victor proposed in 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.
msg260001 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-02-10 10:26
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.
msg260002 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-02-10 10:37
I was about to suggest adding this to test.support as well. Patch looks good to me.
msg260005 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-10 11:13
Addressed Victor's comments. This pattern is not widely used. Usually only raising ResourceWarning is tested, but not non-raising.
msg260040 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-02-10 21:56
test_support_check_no_resource_warning_2.patch LGTM, thanks.
msg260086 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-02-11 11:12
New changeset e9a4b30e3e43 by Serhiy Storchaka in branch '3.5': Issue #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 #26325: Added test.support.check_no_resource_warning() to check that https://hg.python.org/cpython/rev/faf676d8c054
History
Date User Action Args
2022-04-11 14:58:27 admin set github: 70513
2016-02-11 11:38:28 serhiy.storchaka set status: open -> closedassignee: serhiy.storchakaresolution: fixedstage: patch review -> resolved
2016-02-11 11:12:45 python-dev set nosy: + python-devmessages: +
2016-02-10 21:56:09 vstinner set messages: +
2016-02-10 11:13:40 serhiy.storchaka set files: + test_support_check_no_resource_warning_2.patchmessages: +
2016-02-10 10:37:00 martin.panter set nosy: + martin.pantermessages: +
2016-02-10 10:26:21 vstinner set messages: +
2016-02-10 10:15:17 serhiy.storchaka set nosy: + vstinner
2016-02-10 10:14:02 serhiy.storchaka create