Some doctests can't be run twice

Bug #98250 reported by Florent Guillaume
2
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Low
Unassigned
3.4
Won't Fix
Low
Unassigned
zope.testing
Won't Fix
Undecided
Unassigned
zope.testrunner
New
Undecided
Unassigned

Bug Description

For instance this fails during the second run:

./test.py -v -u -s zope.app.form.browser -t test_passwordwidget -N 2

> Running tests at level 1
> Running unit tests:
> Iteration 1
> Running:
> ........
> Ran 8 tests with 0 failures and 0 errors in 0.559 seconds.
> Iteration 2
> Running:
> ........
> Failure in test PasswordWidgetTest (zope.app.form.browser.tests.test_passwordwidget)
> Traceback (most recent call last):
> File "/usr/local/lib/python2.4/unittest.py", line 260, in run
> testMethod()
> File "/usr/local/lib/python2.4/doctest.py", line 2152, in runTest
> raise self.failureException(self.format_failure(new.getvalue()))
> AssertionError: Failed doctest test for zope.app.form.browser.tests.test_passwordwidget.PasswordWidgetTest
> File "/Users/fg/zope/zope3/src/zope/app/form/browser/tests/test_passwordwidget.py", line 25, in PasswordWidgetTest
> --------------------------------------------------------
> File "/Users/fg/zope/zope3/src/zope/app/form/browser/tests/test_passwordwidget.py", line 28, in zope.app.form.browser.tests.test_passwordwidget.PasswordWidgetTest
> Failed example:
> verifyClass(IInputWidget, PasswordWidget)
> Exception raised:
> Traceback (most recent call last):
> File "/usr/local/lib/python2.4/doctest.py", line 1243, in __run
> compileflags, 1) in test.globs
> File "<doctest zope.app.form.browser.tests.test_passwordwidget.PasswordWidgetTest[0]>", line 1, in ?
> verifyClass(IInputWidget, PasswordWidget)
> NameError: name 'verifyClass' is not defined

Revision history for this message
Baiju Muthukadan (baijum) wrote :

If I replace 'import doctest' with 'from zope.testing import doctest' , the error does not exist
so should we replace all 'import doctest' ?

Revision history for this message
Benji York (benji) wrote :

In the short run, I'd prefer we only use zope.testing.doctest.

In the long run we need to figure out how/if we can use a released version of doctest, either by getting hooks put in Python's version so we can extend it as needed, or by using a (currently non-existant) stand-alone release that has a release cycle independent of Python.

Revision history for this message
Baiju Muthukadan (baijum) wrote :
Revision history for this message
Christian Theune (ctheune) wrote :

This is still an issue. We need to fix this in the individual packages, however, it's only of low importance IMHO.

Tres Seaver (tseaver)
Changed in zope3:
status: Confirmed → Won't Fix
Tres Seaver (tseaver)
tags: added: bugday20100424
Revision history for this message
Marius Gedminas (mgedmin) wrote :

This needs to be fixed in zope.testrunner, not zope.testing.

Changed in zope.testing:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.