[Zope3-dev] testInitDB fails

Steve Alexander steve@cat-box.net
Thu, 12 Dec 2002 08:21:43 +0000


Jeremy Hylton wrote:
> I'm currently seeing this error.  I know it's new, but I'm not sure
> how to debug it.
> 
> Jeremy
> 
> ERROR: testInitDB (Zope.App.StartUp.tests.testStartupDirectives.Test)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File
>   "/usr/home/jeremy/src/Zope3/lib/python/Zope/App/StartUp/tests/testStartup
> Directives.py", line 111, in testInitDB
>     sd._initDB()
>   File
>   "/usr/home/jeremy/src/Zope3/lib/python/Zope/App/StartUp/SiteDefinition.py
> ", line 163, in _initDB
>     self._addEssentialServices(app)
>   File
>   "/usr/home/jeremy/src/Zope3/lib/python/Zope/App/StartUp/SiteDefinition.py
> ", line 188, in _addEssentialServices
>     self._addService(root_folder, 'Events', LocalEventService)
>   File
>   "/usr/home/jeremy/src/Zope3/lib/python/Zope/App/StartUp/SiteDefinition.py
> ", line 205, in _addService
>     package = traverse(root_folder, package_name
 >  File
 > "/usr/home/jeremy/src/Zope3/lib/python/Zope/App/Traversing/__init__.py
 > ", line 48, in traverse
 >     return traverser.traverse(path, request=request)
 >  File
 > "/usr/home/jeremy/src/Zope3/lib/python/Zope/App/Traversing/
 >  Traverser.py", line 74, in traverse
 >     curr = getAdapter(self.context, IPhysicallyLocatable

<deletia>

> ComponentLookupError: ('service', 'Adapters')

The problem is that in SiteDefinition.py, line 205, 
Zope.App.Traversing.traverse() is being called, and the test hasn't set 
up an Adapters service, and hasn't registered an IPhysicallyLocatable 
adapter with that service. This is required in order for the call to 
traverse() to work.

Also, if the test is setting up things to do with global adapter 
registries, the test class needs to derive from PlacelessSetup.

--
Steve Alexander