Message 242855 - Python tracker

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.

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.