New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

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

----------
components: Tests
messages: 322946
nosy: ezio.melotti, michael.foord, rbcollins, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Convert deprecated behavior of assertRaises() etc into errors
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34318>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to