[Grok-dev] zope.keyreference.interfaces.NotYet is thrown while running tests

Noe Nieto nnieto at noenieto.com
Wed Apr 25 05:17:25 UTC 2012


Hi,

I have a package homeviva.testing that holds all tests from our aplication.
Inside that package I added a subclass of
zope.app.wsgi.testlayer.BrowserLayer that will add an instance of our grok
application add then add some more dummy data as a way to provide a common
test fixture to all of our integration test.

The layer looks like this:

from zope.app.wsgi.testlayer import BrowserLayer

class HomeVivaIntegrationLayer(BrowserLayer):
    """
    Integration Layer for HomeViva.
    """
    consworks_app = None

    def testSetUp(self):
        super(HomeVivaIntegrationLayer, self).testSetUp()

        #Add test app
        from consworks.app import Consworks
        zodb_root = self.getRootFolder()
        zodb_root['app'] = self.consworks_app = Consworks()

        #Fire up events
        import grok
        grok.notify(grok.ApplicationInitializedEvent(self.consworks_app))

        #... more stuff here

When I run my tests individually all goes fine, but if I try to run all the
tests within the package, no tests are run and a traceback is printed:

$ bin/test -s homeviva.testing
Running homeviva.testing.HomeVivaIntegrationLayer tests:
  Set up homeviva.testing.HomeVivaIntegrationLayer in 4.660 seconds.
  Running:
    2/4 (50.0%)
Traceback (most recent call last):
  File "bin/test", line 222, in <module>
    '--test-path',
'/home/tzicatl/Aplicaciones/Codigo/HomeViva/homeviva_assembla/src/homeviva.reminder',
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/__init__.py",
line 30, in run
    failed = run_internal(defaults, args, script_parts=script_parts)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/__init__.py",
line 43, in run_internal
    runner.run()
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/runner.py",
line 148, in run
    self.run_tests()
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/runner.py",
line 229, in run_tests
    setup_layers, self.failures, self.errors)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/runner.py",
line 390, in run_layer
    return run_tests(options, tests, layer_name, failures, errors)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/runner.py",
line 318, in run_tests
    test(result)
  File "/usr/lib64/python2.7/unittest/case.py", line 391, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib64/python2.7/unittest/case.py", line 302, in run
    result.startTest(self)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/runner.py",
line 726, in startTest
    self.testSetUp()
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.testrunner-4.0.3-py2.7.egg/zope/testrunner/runner.py",
line 711, in testSetUp
    layer.testSetUp()
  File
"/home/tzicatl/Aplicaciones/Codigo/HomeViva/homeviva_assembla/src/homeviva.testing/homeviva/testing/integration.py",
line 13, in testSetUp
    super(HomeVivaIntegrationLayer, self).testSetUp()
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.app.wsgi-3.13.0-py2.7.egg/zope/app/wsgi/testlayer.py",
line 75, in testSetUp
    super(BrowserLayer, self).testSetUp()
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.app.appsetup-3.15.0-py2.7.egg/zope/app/appsetup/testlayer.py",
line 64, in testSetUp
    self.db = createTestDB(self.db_name)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.app.appsetup-3.15.0-py2.7.egg/zope/app/appsetup/testlayer.py",
line 39, in createTestDB
    notify(zope.processlifetime.DatabaseOpened(db))
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.event-3.5.0_1-py2.7.egg/zope/event/__init__.py",
line 23, in notify
    subscriber(event)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/event.py",
line 24, in dispatch
    zope.component.subscribers(event, None)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/_api.py",
line 136, in subscribers
    return sitemanager.subscribers(objects, interface)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/registry.py",
line 321, in subscribers
    return self.adapters.subscribers(objects, provided)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.interface-3.6.3-py2.7-linux-x86_64.egg/zope/interface/adapter.py",
line 583, in subscribers
    subscription(*objects)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.app.appsetup-3.15.0-py2.7.egg/zope/app/appsetup/bootstrap.py",
line 168, in bootStrapSubscriber
    site_manager = site.LocalSiteManager(root_folder)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.site-3.9.2-py2.7.egg/zope/site/site.py",
line 158, in __init__
    self['default'] = folder
  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__
    setitem(self, self._setitemf, key, value)
  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
    notify(event)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.event-3.5.0_1-py2.7.egg/zope/event/__init__.py",
line 23, in notify
    subscriber(event)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/event.py",
line 24, in dispatch
    zope.component.subscribers(event, None)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/_api.py",
line 136, in subscribers
    return sitemanager.subscribers(objects, interface)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/registry.py",
line 321, in subscribers
    return self.adapters.subscribers(objects, provided)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.interface-3.6.3-py2.7-linux-x86_64.egg/zope/interface/adapter.py",
line 583, in subscribers
    subscription(*objects)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/event.py",
line 32, in objectEventNotify
    zope.component.subscribers((event.object, event), None)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/_api.py",
line 136, in subscribers
    return sitemanager.subscribers(objects, interface)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/registry.py",
line 321, in subscribers
    return self.adapters.subscribers(objects, provided)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.interface-3.6.3-py2.7-linux-x86_64.egg/zope/interface/adapter.py",
line 583, in subscribers
    subscription(*objects)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.intid-3.7.2-py2.7.egg/zope/intid/__init__.py",
line 166, in addIntIdSubscriber
    key = IKeyReference(ob, None)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.component-3.10.0-py2.7.egg/zope/component/hooks.py",
line 104, in adapter_hook
    return siteinfo.adapter_hook(interface, object, name, default)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.security-3.8.2-py2.7-linux-x86_64.egg/zope/security/adapter.py",
line 86, in __call__
    adapter = self.factory(*args)
  File
"/home/tzicatl/Aplicaciones/Buildout/eggs/zope.keyreference-3.6.2-py2.7.egg/zope/keyreference/persistent.py",
line 40, in __init__
    raise zope.keyreference.interfaces.NotYet(object)
zope.keyreference.interfaces.NotYet: <zope.site.site.SiteManagementFolder
object at 0x5b725f0>


line 13, in testSetUp is this one: super(HomeVivaIntegrationLayer,
self).testSetUp()

What am I doing wrong?

-- 
---
Noe Nieto
NNieto Consulting Services
M: nnieto at noenieto.com
W: http://noenieto.com
T:  @tzicatl <https://twitter.com/#%21/tzicatl>
Li: Perfil en LinkedIn <http://www.linkedin.com/profile/view?id=84300665>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20120425/e3eeb77c/attachment.html>


More information about the Grok-dev mailing list