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 Arfrever, Tim.Graham, ezio.melotti, magnusc, michael.foord, python-dev, r.david.murray, rbcollins, rhettinger, serhiy.storchaka, steven.daprano
Date 2015-05-10.12:42:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1431261766.26.0.501621622174.issue24134@psf.upfronthosting.co.za>
In-reply-to
Content
Agree, this change breaks general wrappers around assertRaises, and this breakage is unavoidable. Likely we should rollback changes in maintained releases.

The fix in Django doesn't LGTM. It depends on internal detail.

More correct fix should look like:

    def assertRaisesMessage(self, expected_exception, expected_message,
                            *args, **kwargs):
        return six.assertRaisesRegex(self, expected_exception,
                re.escape(expected_message), *args, **kwargs)

I used special sentinel because it is simple solution, but we should discourage to use this detail outside the module. Proposed patch (for 3.5) uses a little more complex approach, that doesn't attract to use implementation details. In additional, added more strict argument checking, only the msg keyword parameter now is acceptable in context manager mode. Please check changed docstrings.

It is possible also to make transition softer. Accept None as a callable and emit the deprecation warning.
History
Date User Action Args
2015-05-10 12:42:46serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, rbcollins, ezio.melotti, Arfrever, steven.daprano, r.david.murray, michael.foord, python-dev, Tim.Graham, magnusc
2015-05-10 12:42:46serhiy.storchakasetmessageid: <1431261766.26.0.501621622174.issue24134@psf.upfronthosting.co.za>
2015-05-10 12:42:46serhiy.storchakalinkissue24134 messages
2015-05-10 12:42:46serhiy.storchakacreate