Examples evaluated more than once if multiple doctest manuels are used
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Manuel |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Doctest manuels are willing to evaluate any region that's parsed as a
doctest example. This means that if you have multiple doctest
manuels, they'll evaluate each other's examples. If you had N
doctest manuels, each example gets evaluated N times.
This is fixed on
http://
Some notes:
- My fix for this is to have each doctest manuel store itself in a
_manuel attribute on it's examples and then to only evaluate those
examples for which it was used for parsing.
With my limited knowledge of manuel internals, this seems reasonable.
- My original fix had a bug. Frighteningly, the bug caused the tests
to pass because it prevented any doctest evaluation. Since manuel
uses it's own doctest to run it's tests, it reported the correct
number of tests run with all tests passing.
I added a single standard doctest to test to make sure that
manuel.doctest was at least minimally working.
- The section in README.txt that dealt with custom evaluators ran into
trouble because it reused a processed document. A document that's
already been processed won't get reparsed. Then, when it got
reprocessed with a new manuel, it didn't evaluate any of the tests,
which then led to a meta test failure that I don't completely (or
even hardly :) understand.
The fix was to make the test recreate the document.
As long as documents cache the results of previous processing, I
don't think it makes sense to reprocess documents with new manuels,
so I think my change was appropriate.
I merged your branch (with some tiny tweaks) and did a 1.4.1 release. Thanks for the fix.