[Python-Dev] Unittest/doctest formatting differences in 2.7a1? (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Sat Dec 12 01:34:47 CET 2009


Lennart Regebro wrote:

On Thu, Dec 10, 2009 at 21:24, Benjamin Peterson <benjamin at python.org> wrote:

2009/12/10 Lennart Regebro <regebro at gmail.com>:

On Thu, Dec 10, 2009 at 20:25, Terry Reedy <tjreedy at udel.edu> wrote:

Since the intent of IGNOREEXCEPTIONDETAIL is to make doctests immune to implementation version specific changes, it seems to me that extending its technical meaning is required to carry out its intent. Would this be considered bugfixy enough to get into 3.1-branch as well as 2.7? It really is damn annoying when you try to port doctests to Python 3, and it would be great if we wouldn't have to wait for 3.2. I think a patch would be helpful before deciding that. Should I start a bug report in the tracker for this?

Yep.

The diff in the code is:

# Another chance if they didn't care about the detail. elif self.optionflags & IGNOREEXCEPTIONDETAIL: - m1 = re.match(r'[^:]*:', example.excmsg) - m2 = re.match(r'[^:]*:', excmsg) - if m1 and m2 and check(m1.group(0), m2.group(0), + m1 = re.match(r'(?:[^:].)?([^:]:)', example.excmsg) + m2 = re.match(r'(?:[^:].)?([^:]:)', excmsg) + if m1 and m2 and check(m1.group(1), m2.group(1), self.optionflags): outcome = SUCCESS But obviously I have patches for both py3k and trunk with tests and updated documentation as well. As you see the diff is pretty simple, it's just a more complex regex.

Looks reasonable to me, although any backport to existing branches will be Benjamin's call for 3.1 and Barry's for 2.6 (as the respective release managers).

Cheers, Nick.

-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia



More information about the Python-Dev mailing list