[Zope3-dev] Doctest failures in persistence/wref.py (WeakRef)

Dave Harris dpharris76 at msn.com
Sun Jan 18 15:19:13 EST 2004


I wasn't able to find any specific information about running doctests on 
individual modules, so I dug around and came up with the following manual 
process (with surprising results.)

First, here's (some of) the information logged during 'python test.py -vv':

doctest of persistence.wref.PersistentWeakKeyDictionary ... ok
doctest of persistence.wref.WeakRef ...

Error in test unittest.FunctionTestCase (runit)
Traceback (most recent call last):
  File "C:\PYTHON23\Lib\unittest.py", line 423, in runTest
    self.__testFunc()
  File "C:\PYTHON23\Lib\doctest.py", line 1359, in runit
    _utest(tester, name, doc, filename, lineno)
  File "C:\PYTHON23\Lib\doctest.py", line 1309, in _utest
    raise DocTestTestFailure('Failed doctest test for %s\n'
DocTestTestFailure: Failed doctest test for persistence.wref.WeakRef
  File "D:\sf\Zope3\src\persistence\wref.py", line 105 (or above), in 
WeakRef

*****************************************************************
Failure in example: conn3.root()['ref']()
from line #64 of persistence.wref.WeakRef
Expected: nothing
Got: []
*****************************************************************
Failure in example: hash(conn3.root()['ref'])
from line #68 of persistence.wref.WeakRef
Expected:
Traceback (most recent call last):
..
TypeError: Weakly-referenced object has gone away
Got: 50875728

And here's the manual process I used to re-run the tests:

cd /sf/zope/src    # where my CVS workspace is
python
>>> from zope/testing/doctestunit import DocTestSuite
>>> suite = DocTestSuite(module='persistence.wref')
>>> import unittest
>>> unittest.TextTestRunner().run(suite)

Ran 2 tests in .351s

Well, what do you know. No lumps. But then I inadvertently re-executed the 
last command [unittest.TextTestRunner().run(suite)], and, you guessed it, I 
got the same set of error messages generated during the full test.py run.

Before I go rescuing Herbert, should I have any faith in what I've done?

(And is persistence/wref.py a viable part of Zope3? ;)

Dave Harris 



More information about the Zope3-dev mailing list