Code

Opened 5 years ago

Closed 3 years ago

#11436 closed Bug (fixed)

_doctest.py needs updating

Reported by: kmtracey 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: UI/UX:

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.)

Attachments (0)

Change History (6)

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by lsaffre

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 Changed 3 years ago by julien

  • Resolution set to wontfix
  • Severity set to Normal
  • Status changed from new to closed
  • Type set to Uncategorized

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

comment:4 Changed 3 years ago by julien

  • Resolution wontfix deleted
  • Status changed from closed to reopened

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

comment:5 Changed 3 years ago by julien

  • Type changed from Uncategorized to Bug

comment:6 Changed 3 years ago by ramiro

  • Resolution set to fixed
  • Status changed from reopened to closed

In [16292]:

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.