Tue, 01 Jul 2008 15:30:47 -0400, Alan McIntyre wrote: > On Tue, Jul 1, 2008 at 3:20 PM, Robert Kern <[EMAIL PROTECTED]> > wrote: >> Can it work on an entire section? If not, can we do something that >> works on a whole section? Everything after "Plot the window and its >> frequency response:" is not required for testing. > > It's on a per-line basis at the moment, so each lines needs a "#doctest: > +SKIP". Changing a directive to apply to multiple lines probably isn't > trivial (I haven't really looked into doing that, though).
I think this can be done without too many problems: Looking at the doctest.py source code, the easiest way to change the way how docstrings are parsed into doctests is to subclass `DoctestParser` and override its `parse` method. The `testmod` and `testfile` functions don't take a parser argument, but they appear to be only thin wrappers for instantiating `DocTestFinder` (which does take a parser argument) and then calling a method in `DocTestRunner`. Now, things appear to work a bit differently in nose. There, DocTestParser is instantiated by Doctest.loadTestsFromFile in the doctests.py plugin. I don't see an easy way to override this, except for monkeypatching doctest.DocTestParser or the whole nose plugin with our stuff. All in all, I'd estimate this to be ~100 lines, put in a suitable location. But it's a custom tweak to doctest, so it might break at some point in the future, and I don't love the monkeypatching here... > We could always just make the plotting section one of those "it's just > an example not a doctest" things and remove the ">>>" (since it doesn't > appear to provide any useful test coverage or anything). If possible, I'd like other possibilities be considered first before jumping this route. I think it would be nice to retain the ability to run also the matplotlib examples as (optional) doctests, to make sure also they execute correctly. Also, using two different markups in the documentation to work around a shortcoming of doctest is IMHO not very elegant. -- Pauli Virtanen _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion