[Zope3-dev] Re: Are the demo products broken in MS4?

Barry Pederson bp at barryp.org
Fri Dec 12 22:56:05 EST 2003


Stephan Richter wrote:

> On Friday 12 December 2003 17:10, Barry Pederson wrote:
> 
>>I just remembered another glitch I ran into...in the first recipe chapter,
>>writing the unittests 'test_messageboard.py' and 'test_message.py' - there
>>was a problem with subclassing from BaseTestIContainer.
> 
> 
> Are you positive? I just updated my Zope and tested the step1 from CVS and it 
> worked just fine.

This is what I was seeing with the original test_messageboard.py (comments 
at the end) ...



======================================================================
ERROR: testBadKeyTypes (zopeproducts.messageboard.tests.test_messageboard.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/usr/home/barryp/Zope3/src/zope/app/container/tests/test_icontainer.py", 
line 167, in testBadKeyTypes
     for name in self.getBadKeyTypes():
AttributeError: 'Test' object has no attribute 'getBadKeyTypes'

======================================================================
ERROR: test_delObject (zopeproducts.messageboard.tests.test_messageboard.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/usr/home/barryp/Zope3/src/zope/app/container/tests/test_icontainer.py", 
line 137, in test_delObject
     self.getUnknownKey())
AttributeError: 'Test' object has no attribute 'getUnknownKey'

======================================================================
ERROR: test_get (zopeproducts.messageboard.tests.test_messageboard.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
   File 
"/usr/home/barryp/Zope3/src/zope/app/container/tests/test_icontainer.py", 
line 75, in test_get
     self.getUnknownKey())
AttributeError: 'Test' object has no attribute 'getUnknownKey'

----------------------------------------------------------------------
Ran 29 tests in 0.137s

FAILED (errors=3)
--------------------------------




I thought it made sense - looking at 
zope/app/container/tests/test_icontainer.py the BaseTestIContainer class 
does call those getUnknownKey and getBadKeyTypes methods, but since the 
sample code from the wiki code doesn't define them I can see how it would 
fail.

I figured the easier alternative was to subclass the Test from 
test_icontainer.py, which gets you the missing methods, along with 
makeTestData.

test_message.py came up with exactly the same errors IIRC.

	Barry





More information about the Zope3-dev mailing list