This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ezio.melotti, michael.foord, rbcollins, serhiy.storchaka
Date 2018-08-02.11:39:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533209994.63.0.56676864532.issue34318@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-08-02 11:39:54serhiy.storchakasetrecipients: + serhiy.storchaka, rbcollins, ezio.melotti, michael.foord
2018-08-02 11:39:54serhiy.storchakasetmessageid: <1533209994.63.0.56676864532.issue34318@psf.upfronthosting.co.za>
2018-08-02 11:39:54serhiy.storchakalinkissue34318 messages
2018-08-02 11:39:54serhiy.storchakacreate