-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
longMessage attribute is ignored in unittest.TestCase.assertRegexpMatches etc #64561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Various assert methods added in version 2.7 ignore the longMessage attribute: For example when matching regular expressions using unittest.TestCase.assertRegexpMatches, the following error is generated: AssertionError: <custom short message>: '<regexp>' not found in '<text>' Since longMessage is ignored, and the text to be matched can be pages long, the error messages are impossibly long. [See also: http://stackoverflow.com/questions/21157905/suppress-supplementary-error-message-from-unit-test] |
I've added missing self._formatMessage() functions to assertRegex and assertNotRegex asserts. |
This fix has been retested with 2.7, I'm uploading the relevant patch files. |
Modified to work with 3.5. Attaching patch file. |
Thanks for the patches, Ilia. The one for 2.7 looks good. Reviewing 20362_py35.patch:
|
Thanks for the quick response, Berker! Let me address your comments in the order you made them. #1: removing checking for "kot" in the exception args. #2 Glad to help! |
Hi Berker! I hope all's well on your end. Let me know if you have questions about the reasoning behind my changes. |
Hi there! I was wondering if anyone had a chance to take a look at this :) |
I notice folks have been subscribing to this. Any chance we could review it and merge? :) |
Other than that the patch looks good (I am not a committer, though, so I can't help further). |
Sorry for my late response, Ilia. Your reply to my first question looks correct to me. Please send your updated patch and I'll apply. |
Thanks for the feedback, folks. Adding the updated patch. |
Bump :) Let's close this one, guys! |
New changeset 738de9a9a3ea by Robert Collins in branch '3.5': New changeset 977e60f597de by Robert Collins in branch 'default': |
Thanks for the patch, applied to 3.5 and 3.6. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: