[ZPatterns] Unit Testing ZPatterns Apps
Roch'e Compaan
[email protected]
Sat, 27 Oct 2001 12:10:33 +0200
We have quite a number of apps running on ZPatterns 0.4.3 and Zope 2.3.
All of the apps TTW and uses ZClasses.
I have tried to set up some unit tests using ZUnit 0.1. I've managed
to call simple methods that report on the number of items in a specialist
and don't do any serious processing.
When I tried to test instance creation it failed with the following error:
Traceback (innermost last):
File
"/usr/local/zope/2-3-2/lib/python/Products/PMTests/tests/ErvenTests.py",
line 38, in test_addAllotment
Allotments.addInstance(REQUEST)
File "/usr/local/zope/2-3-1/lib/python/Shared/DC/Scripts/Bindings.py",
line 324, in __call__
File "/usr/local/zope/2-3-1/lib/python/Shared/DC/Scripts/Bindings.py",
line 354, in _bindAndExec
File
"/usr/local/zope/2-3-2/lib/python/Products/PythonScripts/PythonScript.py",
line 336, in _exec
result = apply(f, args, kw)
File "Script (Python)", line 20, in addInstance
File "/home/httpd/zope/Products/ZPatterns/Specialists.py", line 40, in
newItem
return self.rackList[0].__of__(self).newItem(key)
File "/home/httpd/zope/Products/ZPatterns/Rack.py", line 73, in newItem
return self.createItem(key)
File "/home/httpd/zope/Products/ZPatterns/Rack.py", line 128, in
createItem
item = self.getItem(key)
File "/home/httpd/zope/Products/ZPatterns/Rack.py", line 59, in getItem
item = self.retrieveItem(key)
File "/home/httpd/zope/Products/ZPatterns/Rack.py", line 97, in
retrieveItem
if hasattr(item.aq_base, a):
File "/home/httpd/zope/Products/ZPatterns/DataSkins.py", line 218, in
__get_attr__
self = self._canonicalForm()
File "/home/httpd/zope/Products/ZPatterns/DataSkins.py", line 240, in
_canonicalForm
self.__dict__['_v_parent']
KeyError: _v_parent
What might cause this? Is there anything specifically that one should
do in the set up of the test. Has anybody been succesful in writing unit
tests for ZPatterns apps?
Roché