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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
GitHub fields:
assignee = None closed_at = <Date 2020-07-01.21:09:42.076> created_at = <Date 2020-01-18.20:25:23.335> labels = ['type-feature', 'library', '3.10'] title = 'Add an assertNoLogs context manager to unittest TestCase' updated_at = <Date 2020-09-19.09:32:42.441> user = 'https://github.com/kitchoi'
bugs.python.org fields:
activity = <Date 2020-09-19.09:32:42.441> actor = 'mark.dickinson' assignee = 'none' closed = True closed_date = <Date 2020-07-01.21:09:42.076> closer = 'vinay.sajip' components = ['Library (Lib)'] creation = <Date 2020-01-18.20:25:23.335> creator = 'Kit Yan Choi' dependencies = [] files = [] hgrepos = [] issue_num = 39385 keywords = ['patch'] message_count = 4.0 messages = ['360250', '367129', '367134', '372794'] nosy_count = 9.0 nosy_names = ['vinay.sajip', 'mark.dickinson', 'rbcollins', 'ezio.melotti', 'michael.foord', 'Kit Yan Choi', 'francois.freitag', 'remi.lapeyre', 'xtreak'] pr_nums = ['18067', '22317'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue39385' versions = ['Python 3.10']
The text was updated successfully, but these errors were encountered:
assertLogs is really useful (bpo-18937). Unfortunately it does not cover the use cases where one wants to ensure no logs are emitted.
Similar to assertLogs, we can have a context manager for asserting no logs, something like this?:
with assertNoLogs(logger, level): ...
If logs are unexpected found, the test would fail with the logs captured included in the error message.
Happy to submit a PR if there is interest.
Sorry, something went wrong.
This makes sense, should assertNoWarns() be added too?
Thank you for looking into this. Yes, I agree it makes sense to have assertNoWarns for the same reason.
New changeset 6b34d7b by Kit Choi in branch 'master': bpo-39385: Add an assertNoLogs context manager to unittest.TestCase (GH-18067) 6b34d7b
No branches or pull requests
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: