Opened 15 years ago

Closed 13 years ago

#11436 closed Bug (fixed)

_doctest.py needs updating

Reported by: Karen Tracey Owned by: nobody
Component: Testing framework Version: 1.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I just tried annotating a doctest in a models.py file with the +SKIP directive and was puzzled to find that that resulted in all doctests in that file being ignored. Apparently the doctest runner bails (silently?) on any directives it doesn't understand, and as the _doctest.py used by Django is from Python 2.4 and +SKIP was added for 2.5, Django's doctest runner doesn't understand +SKIP.

I think we need to look into updating _doctest.py to include support for options/directives like this that have been added since 2.4. If I'm running Python 2.5 or 2.6 I expect to have access to the things added for those releases -- I haven't been able to find that we even document that Django uses it's own customized doctest runner? (It might be somewhat confusing for people running older levels if they happen to notice they can use newer options, but that doesn't really strike me as a problem.)

(Better would be to be able to use the Python doctest, if running a high enough Python level, but that level doesn't appear to exist yet. Python issue 1521051 (http://bugs.python.org/issue1521051) has not made it into the code base yet, it's sitting in "test needed" stage.)

Change History (6)

comment:1 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Luc Saffre, 15 years ago

It would already be a good workaround to change the current _doctest.py so that it no longer silently ignores such errors.
If you get an error message then you don't lose time figuring out where it comes from.
I documented a related experience:
http://lsaffre.blogspot.com/2009/10/when-your-django-doctests-never-fail.html

comment:3 by Julien Phalip, 14 years ago

Resolution: wontfix
Severity: Normal
Status: newclosed
Type: Uncategorized

Django does not support Python 2.4 any more (and it also discourages the use of doctests).

comment:4 by Julien Phalip, 14 years ago

Resolution: wontfix
Status: closedreopened

Apologies, you're right in that the _doctests.py module should be updated.

comment:5 by Julien Phalip, 14 years ago

Type: UncategorizedBug

comment:6 by Ramiro Morales, 13 years ago

Resolution: fixed
Status: reopenedclosed

In [16292]:

Fixed #11436 -- Updated bundled copy of doctests.py to the one shipped with Python 2.5, preserved local tweaks.

Note: See TracTickets for help on using tickets.
Back to Top