I just got sick of trying to decode obtuse doctest diff errors when using NORMALIZE_WHITESPACE and ELLIPSIS options. Although doctest gives you hooks to do something about this, it's really hard to actually write the logic.
See, NORMALIZE_WHITESPACE also normalizes line breaks, and '...' can match across multiple lines. That means that you can't take a line-based approach, which makes it really hard to clean up a diff. Anyway, here's my attempt: https://code.launchpad.net/~jml/testtools/better-doctest-output-checker/+merge/74842
It's a pain, because both of them would be very useful without their line-spanning behaviour. I guess without the line-spanning behaviour of '...' there'd be no way to indicate multiple lines of crap in output.
My suggestion in the mean time? Don't use doctest.
Hacking, Software Collaboration, Testing and Diverse Other Topics of General Interest to the Practicing Programmer
Friday, September 9, 2011
Subscribe to:
Post Comments (Atom)
Blog Archive
-
►
2010
(68)
-
►
November
(14)
- testtools manuals
- Tests that print stuff
- Boiling kettles, unit tests and data
- Big or small?
- "Don't Make Me Think", thoughts for Launchpad
- Reviewing specs, rock on!
- Having an extra feature never hurts, rebutted
- And then what?
- Make it really easy to fix bugs on Ubuntu
- What else have you got?
- Ubuntu in a VM on OS X?
- Still going
- What to do, what to do
- Launchpad and UDS-N
-
►
November
(14)

2 comments:
I'm not a fan of doctest.OutputChecker either. I don't find spelling assertions with ellipses rather than regular expressions much of an improvement, and the mismatch output nearly always confuses me. There must be some better pattern for doing checks on (potentially very) large text blocks that's easy to write and actually produces good errors. I've not managed to come up with one though...
I think line-based checking could be a good start.
Post a Comment