I'm writing some integration test for our products. I'm placing that tests in a separate package: homeviva.testing<br><br>When I run my test, with zope.testrunner, I'm always having the following traceback:<br>
<br>Error in test test_consworks_views (homeviva.testing.tests.test_dbmodels.ConsworksTestCase)<br>Traceback (most recent call last):<br> File "/usr/lib64/python2.7/unittest/case.py", line 318, in run<br> self.setUp()<br>
File "/home/tzicatl/Aplicaciones/Codigo/HomeViva/homeviva_trunk/src/homeviva.testing/homeviva/testing/tests/test_dbmodels.py", line 26, in setUp<br> self.root['app'] = Consworks()<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.container-3.12.0-py2.7-linux-x86_64.egg/zope/container/folder.py", line 95, in __setitem__<br>
setitem(self, self.data.__setitem__, name, object)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.container-3.12.0-py2.7-linux-x86_64.egg/zope/container/contained.py", line 559, in setitem<br> notify(event)<br>
File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.event-3.5.0_1-py2.7.egg/zope/event/__init__.py", line 23, in notify<br> subscriber(event)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/event.py", line 24, in dispatch<br>
zope.component.subscribers(event, None)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/_api.py", line 136, in subscribers<br> return sitemanager.subscribers(objects, interface)<br>
File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/registry.py", line 321, in subscribers<br> return self.adapters.subscribers(objects, provided)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.interface-3.6.1-py2.7-linux-x86_64.egg/zope/interface/adapter.py", line 585, in subscribers<br>
subscription(*objects)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/event.py", line 32, in objectEventNotify<br> zope.component.subscribers((event.object, event), None)<br>
File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/_api.py", line 136, in subscribers<br> return sitemanager.subscribers(objects, interface)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/registry.py", line 321, in subscribers<br>
return self.adapters.subscribers(objects, provided)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.interface-3.6.1-py2.7-linux-x86_64.egg/zope/interface/adapter.py", line 585, in subscribers<br> subscription(*objects)<br>
File "/home/tzicatl/Aplicaciones/Buildout/eggs/grok-1.4.3-py2.7.egg/grok/meta.py", line 175, in __call__<br> self._createIntIds(site)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/grok-1.4.3-py2.7.egg/grok/meta.py", line 216, in _createIntIds<br>
setupUtility(site, intids, IIntIds)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/grokcore.site-1.5-py2.7.egg/grokcore/site/meta.py", line 108, in setupUtility<br> container[name_in_container] = utility<br>
File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.container-3.12.0-py2.7-linux-x86_64.egg/zope/container/btree.py", line 112, in __setitem__<br> setitem(self, self._setitemf, key, value)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.container-3.12.0-py2.7-linux-x86_64.egg/zope/container/contained.py", line 560, in setitem<br>
notifyContainerModified(container)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.container-3.12.0-py2.7-linux-x86_64.egg/zope/container/contained.py", line 332, in notifyContainerModified<br> notify(ContainerModifiedEvent(object, *descriptions))<br>
File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.event-3.5.0_1-py2.7.egg/zope/event/__init__.py", line 23, in notify<br> subscriber(event)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/event.py", line 24, in dispatch<br>
zope.component.subscribers(event, None)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/_api.py", line 136, in subscribers<br> return sitemanager.subscribers(objects, interface)<br>
File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/registry.py", line 321, in subscribers<br> return self.adapters.subscribers(objects, provided)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.interface-3.6.1-py2.7-linux-x86_64.egg/zope/interface/adapter.py", line 585, in subscribers<br>
subscription(*objects)<br> File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.catalog-3.8.1-py2.7.egg/zope/catalog/catalog.py", line 197, in reindexDocSubscriber<br> id = component.getUtility(IIntIds, context=cat).queryId(ob)<br>
File "/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/_api.py", line 169, in getUtility<br> raise ComponentLookupError(interface, name)<br>ComponentLookupError: (<InterfaceClass zope.intid.interfaces.IIntIds>, '')<br>
<br>My testcase looks like this:<br><br><br>class ConsworksTestCase(unittest.TestCase):<br> """<br> TestCase for the Consworks app object<br> """<br> layer = HomeVivaIntegrationLayer(homeviva.testing)<br>
<br> def setUp(self):<br> #Add test app<br> from consworks.app import Consworks<br> self.root = self.layer.getRootFolder()<br> self.root['app'] = Consworks()<br> self.app = self.root['app']<br>
<br> def test_here(self):<br> ....<br><br>I tried to manually register a Intid utility in my layer, but with no results.<br><br>from zope.app.wsgi.testlayer import BrowserLayer<br>from zope.site.hooks import getSiteManager<br>
from zope.intid.interfaces import IIntIds<br>from zope.intid import IntIds<br><br>class HomeVivaIntegrationLayer(BrowserLayer):<br> """<br> Integration Layer for HomeViva.<br> """<br>
<br> def testSetUp(self):<br> super(HomeVivaIntegrationLayer, self).testSetUp()<br> # root = self.getRootFolder()<br> # sm = getSiteManager()<br> # sm.registerUtility(IntIds(), provided=IIntIds)<br>
# import pdb; pdb.set_trace( )<br><br><br><br>Anyone has hit this error? how did you fixed it?<br><br><br clear="all"><br>-- <br><span style="color:rgb(255,204,102)">---</span><br>
<span style="color:rgb(204,153,51)">Noe Nieto</span><br>
NNieto Consulting Services<br>
M: <a href="mailto:nnieto@noenieto.com" target="_blank">nnieto@noenieto.com</a><br>
W: <a href="http://noenieto.com" target="_blank">http://noenieto.com</a><br>
T: <a href="https://twitter.com/#%21/tzicatl" target="_blank">@tzicatl</a><br>Li: <a href="http://www.linkedin.com/profile/view?id=84300665" target="_blank">Perfil en LinkedIn</a><br><br>