
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2014-01-23 09:39 byDhara, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue20362.diff | berker.peksag,2014-05-18 05:08 | review | ||
| 20362_py27.patch | copper-head,2015-04-13 20:30 | 2.7 patch | review | |
| 20362_py35.patch | copper-head,2015-04-13 20:31 | 3.5 patch | ||
| 20362_py35_v2.patch | copper-head,2015-08-03 16:13 | 3.5 patch v2 | ||
| Messages (15) | |||
|---|---|---|---|
| msg208899 -(view) | Author: Dhara (Dhara) | Date: 2014-01-23 09:39 | |
Various assert methods added in version 2.7 ignore the longMessage attribute:http://docs.python.org/2.7/library/unittest.html#unittest.TestCase.longMessageFor 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] | |||
| msg218733 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2014-05-18 05:08 | |
I've added missing self._formatMessage() functions to assertRegex and assertNotRegex asserts. | |||
| msg240737 -(view) | Author: Ilia Kurenkov (copper-head)* | Date: 2015-04-13 20:30 | |
This fix has been retested with 2.7, I'm uploading the relevant patch files. | |||
| msg240740 -(view) | Author: Ilia Kurenkov (copper-head)* | Date: 2015-04-13 20:31 | |
Modified to work with 3.5. Attaching patch file. | |||
| msg240745 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2015-04-13 20:56 | |
Thanks for the patches, Ilia. The one for 2.7 looks good.Reviewing 20362_py35.patch:* Looks almost identical toissue20362.diff except style changes and the two comments below, right?* - self.assertIn("'kot'", e.args[0]) Why did you remove this line?* + assertNotRegexpMatches = _deprecate(assertNotRegex) This looks like an unrelated change, but I think it can be committed. Thanks for the catch!* The tests should be updated to use assertRegex and assertNotRegex | |||
| msg240836 -(view) | Author: Ilia Kurenkov (copper-head)* | Date: 2015-04-14 03:17 | |
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.This line was causing the tests to fail, which is how I noticed it. The reason it fails (I think) is caused by the changes made in the patch. Namely, the fact that we're strictly sticking to longMessage=False means the custom message passed by the user (in this particular case that's "Message") is be the *only* thing sent to AssertionError. Thus checking for the presence of "kot" in this error's args doesn't seem to make much sense and will simply keep breaking our tests.Now it goes without saying that I may have missed something, please let me know if that's the case.#2For some reason I got the impression that the tests should be using the newer method names, but since using the old ones didn't break them on my machine, I've updated the patch file accordingly. I'll upload it pending your feedback regarding #1.Glad to help!Ilia. | |||
| msg241635 -(view) | Author: Ilia Kurenkov (copper-head)* | Date: 2015-04-20 12:24 | |
Hi Berker!I hope all's well on your end. Let me know if you have questions about the reasoning behind my changes. | |||
| msg242880 -(view) | Author: Ilia Kurenkov (copper-head)* | Date: 2015-05-11 02:01 | |
Hi there!I was wondering if anyone had a chance to take a look at this :) | |||
| msg247888 -(view) | Author: Ilia Kurenkov (copper-head)* | Date: 2015-08-02 19:03 | |
I notice folks have been subscribing to this. Any chance we could review it and merge? :) | |||
| msg247920 -(view) | Author: Arnon Yaari (wiggin15)* | Date: 2015-08-03 08:30 | |
* The removal of the 'kot' test is ok. That's what the fix is about. With longMessage set to False, we should only see the custom message, 'Message', and not the message about the regex that contains 'kot'.* Please update the patch for 3.5 to use assertRegex and assertNotRegex in the assertMessages call. These are the new names. With the current patch, the tests throw deprecation warnings.Other than that the patch looks good (I am not a committer, though, so I can't help further). | |||
| msg247922 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2015-08-03 09:35 | |
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. | |||
| msg247932 -(view) | Author: Ilia Kurenkov (copper-head)* | Date: 2015-08-03 16:13 | |
Thanks for the feedback, folks. Adding the updated patch. | |||
| msg248422 -(view) | Author: Ilia Kurenkov (copper-head)* | Date: 2015-08-11 18:24 | |
Bump :)Let's close this one, guys! | |||
| msg248862 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2015-08-19 23:14 | |
New changeset738de9a9a3ea by Robert Collins in branch '3.5':Issue#20362: Honour TestCase.longMessage correctly in assertRegex.https://hg.python.org/cpython/rev/738de9a9a3eaNew changeset977e60f597de by Robert Collins in branch 'default':Issue#20362: Honour TestCase.longMessage correctly in assertRegex.https://hg.python.org/cpython/rev/977e60f597de | |||
| msg248865 -(view) | Author: Robert Collins (rbcollins)*![]() | Date: 2015-08-19 23:24 | |
Thanks for the patch, applied to 3.5 and 3.6. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:57 | admin | set | github: 64561 |
| 2015-08-19 23:24:52 | rbcollins | set | status: open -> closed resolution: fixed messages: +msg248865 stage: commit review -> resolved |
| 2015-08-19 23:14:02 | python-dev | set | nosy: +python-dev messages: +msg248862 |
| 2015-08-19 23:03:41 | rbcollins | set | stage: patch review -> commit review |
| 2015-08-11 18:24:49 | copper-head | set | messages: +msg248422 |
| 2015-08-03 16:13:45 | copper-head | set | files: +20362_py35_v2.patch messages: +msg247932 |
| 2015-08-03 09:35:52 | berker.peksag | set | assignee:berker.peksag messages: +msg247922 versions: + Python 3.4, Python 3.6 |
| 2015-08-03 08:30:03 | wiggin15 | set | messages: +msg247920 versions: - Python 3.4 |
| 2015-08-02 19:03:22 | copper-head | set | messages: +msg247888 |
| 2015-06-17 09:31:15 | bronger | set | nosy: +bronger |
| 2015-05-17 21:58:03 | wiggin15 | set | nosy: +wiggin15 |
| 2015-05-11 21:43:38 | ned.deily | set | nosy: +rbcollins |
| 2015-05-11 02:01:22 | copper-head | set | messages: +msg242880 |
| 2015-04-20 12:24:53 | copper-head | set | messages: +msg241635 |
| 2015-04-14 03:17:11 | copper-head | set | messages: +msg240836 |
| 2015-04-13 20:56:01 | berker.peksag | set | messages: +msg240745 |
| 2015-04-13 20:31:49 | copper-head | set | files: +20362_py35.patch messages: +msg240740 |
| 2015-04-13 20:30:44 | copper-head | set | files: +20362_py27.patch nosy: +copper-head messages: +msg240737 |
| 2014-05-18 05:08:23 | berker.peksag | set | files: +issue20362.diff versions: - Python 3.3 keywords: +patch nosy: +berker.peksag messages: +msg218733 stage: needs patch -> patch review |
| 2014-02-10 08:13:48 | ezio.melotti | set | keywords: +easy stage: needs patch versions: + Python 3.3, Python 3.4, Python 3.5 |
| 2014-01-23 13:22:49 | berker.peksag | set | nosy: +ezio.melotti,michael.foord |
| 2014-01-23 09:39:37 | Dhara | create | |