Issue34318
Created on 2018-08-02 11:39 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 8623 | merged | serhiy.storchaka, 2018-08-02 11:48 | |
| Messages (2) | |||
|---|---|---|---|
| msg322946 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2018-08-02 11:39 | |
Currently assertRaises(), assertRaisesRegex(), assertWarns() and assertWarnsRegex() have some weird behavior.
# always success if the callable is None
self.assertRaises(SomeException, None)
# keyword arguments except "msg" are ignored
with self.assertRaises(SomeException, foobar=123):
...
# always success because keyword arguments are ignored
self.assertRaises(SomeException, callable=func)
Hardly any user code uses these "features" intentionally. More likely such examples are hidden bugs (see for example [1]). A DeprecationWarning is raised in these cases since 3.5 (issue24134), and it is time to make them errors.
[1] https://mail.python.org/pipermail/python-list/2018-July/736363.html
|
|||
| msg323745 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2018-08-19 07:00 | |
New changeset 77d5781835b6e0a132694ebadc22b1cbdb9913f8 by Serhiy Storchaka in branch 'master': bpo-34318: Convert deprecation warnings to errors in assertRaises() etc. (GH-8623) https://github.com/python/cpython/commit/77d5781835b6e0a132694ebadc22b1cbdb9913f8 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:04 | admin | set | github: 78499 |
| 2018-08-19 07:49:21 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-08-19 07:00:15 | serhiy.storchaka | set | messages: + msg323745 |
| 2018-08-02 11:48:50 | serhiy.storchaka | set | keywords:
+ patch stage: patch review pull_requests: + pull_request8128 |
| 2018-08-02 11:40:18 | serhiy.storchaka | set | components: + Library (Lib) |
| 2018-08-02 11:39:54 | serhiy.storchaka | create | |