bluedynamics / bda.plone.ticketshop

Sell tickets for events
Other
1 stars 1 forks source link

when running tests: ZODB connection error #4

Closed thet closed 10 years ago

thet commented 10 years ago

when running the tests for bda.plone.ticketshop, i get this strange ZODB and collective.z3cform.datagridfield related error. running tests for bda.plone.shop does work, and the testlayer setup in ticketshop is resembled after those in shop.

[thet@luft bda.plone.ticketshop]$ ./bin/test --all -s bda.plone.ticketshop -t robot
Running bda.plone.ticketshop.tests.TicketshopAT:Robot tests:
  Set up plone.testing.zca.LayerCleanup in 0.000 seconds.
  Set up plone.testing.z2.Startup in 0.241 seconds.
  Set up plone.app.testing.layers.PloneFixture in 10.206 seconds.
  Set up plone.app.robotframework.testing.MockMailHostLayer in 0.011 seconds.
  Set up bda.plone.shop.tests.ShopLayer/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.configuration-3.7.4-py2.7.egg/zope/configuration/fields.py:417: UserWarning: You did not specify an i18n translation domain for the 'description' field in /home/thet-data/data/dev/bda/bda.plone.ticketshop/devsrc/bda.plone.shop/src/bda/plone/shop/profiles.zcml
  "'%s' field in %s" % (self.getName(), context.info.file )
/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.configuration-3.7.4-py2.7.egg/zope/configuration/fields.py:417: UserWarning: You did not specify an i18n translation domain for the 'title' field in /home/thet-data/data/dev/bda/bda.plone.ticketshop/devsrc/bda.plone.shop/src/bda/plone/shop/profiles.zcml
  "'%s' field in %s" % (self.getName(), context.info.file )
/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.configuration-3.7.4-py2.7.egg/zope/configuration/fields.py:417: UserWarning: You did not specify an i18n translation domain for the 'description' field in /home/thet-data/data/dev/bda/bda.plone.ticketshop/devsrc/bda.plone.shop/src/bda/plone/shop/configure.zcml
  "'%s' field in %s" % (self.getName(), context.info.file )
/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.configuration-3.7.4-py2.7.egg/zope/configuration/fields.py:417: UserWarning: You did not specify an i18n translation domain for the 'title' field in /home/thet-data/data/dev/bda/bda.plone.ticketshop/devsrc/bda.plone.shop/src/bda/plone/shop/configure.zcml
  "'%s' field in %s" % (self.getName(), context.info.file )
 in 7.449 seconds.
  Set up bda.plone.ticketshop.tests.TicketshopLayer Traceback (most recent call last):
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 366, in run_layer
    setup_layer(options, layer, setup_layers)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 628, in setup_layer
    setup_layer(options, base, setup_layers)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 628, in setup_layer
    setup_layer(options, base, setup_layers)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 633, in setup_layer
    layer.setUp()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/plone.app.testing-4.2.4-py2.7.egg/plone/app/testing/helpers.py", line 344, in setUp
    setSite(None)
  File "/usr/lib64/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/plone.app.testing-4.2.4-py2.7.egg/plone/app/testing/helpers.py", line 236, in ploneSite
    setSite(site)
  File "/usr/lib64/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/plone.testing-4.0.11-py2.7.egg/plone/testing/z2.py", line 261, in zopeApp
    transaction.commit()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_manager.py", line 89, in commit
    return self.get().commit()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 329, in commit
    self._commitResources()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 443, in _commitResources
    rm.commit(self)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 567, in commit
    self._commit(transaction)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 623, in _commit
    self._store_objects(ObjectWriter(obj), transaction)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 658, in _store_objects
    p = writer.serialize(obj)  # This calls __getstate__ of obj
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 422, in serialize
    return self._dump(meta, obj.__getstate__())
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 431, in _dump
    self._p.dump(state)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 352, in persistent_id
    "database connection", self._jar, obj,
InvalidObjectReference: ('Attempt to store an object from a foreign database connection', <Connection at 131c4610>, <collective.z3cform.datagridfield.registry.DictRow object at 0x40c8578>)

Tearing down left over layers:
  Tear down plone.app.robotframework.testing.MockMailHostLayer
Traceback (most recent call last):
  File "./bin/test", line 363, in <module>
    '--test-path', '/home/thet-data/data/dev/bda/bda.plone.ticketshop/devsrc/plone.formwidget.recurrence',
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/__init__.py", line 35, in run
    failed = run_internal(defaults, args, script_parts=script_parts)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/__init__.py", line 48, in run_internal
    runner.run()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 138, in run
    self.run_tests()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 242, in run_tests
    tear_down_unneeded(self.options, (), setup_layers, True)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 605, in tear_down_unneeded
    l.tearDown()
  File "/home/thet-data/data/dev/bda/bda.plone.ticketshop/devsrc/plone.app.robotframework/src/plone/app/robotframework/testing.py", line 86, in tearDown
    portal.MailHost = portal._original_MailHost
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 979, in register
    self._register(obj)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 989, in _register
    self.transaction_manager.get().join(self)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 213, in join
    self._prior_operation_failed() # doesn't return
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 209, in _prior_operation_failed
    self._failure_traceback.getvalue())
transaction.interfaces.TransactionFailedError: An operation previously failed, with traceback:

  File "./bin/test", line 363, in <module>
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/__init__.py", line 35, in run
    failed = run_internal(defaults, args, script_parts=script_parts)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/__init__.py", line 48, in run_internal
    runner.run()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 138, in run
    self.run_tests()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 219, in run_tests
    setup_layers, self.failures, self.errors)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 366, in run_layer
    setup_layer(options, layer, setup_layers)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 628, in setup_layer
    setup_layer(options, base, setup_layers)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 628, in setup_layer
    setup_layer(options, base, setup_layers)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/zope.testing-3.9.7-py2.7.egg/zope/testing/testrunner/runner.py", line 633, in setup_layer
    layer.setUp()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/plone.app.testing-4.2.4-py2.7.egg/plone/app/testing/helpers.py", line 344, in setUp
    setSite(None)
  File "/usr/lib64/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/plone.app.testing-4.2.4-py2.7.egg/plone/app/testing/helpers.py", line 236, in ploneSite
    setSite(site)
  File "/usr/lib64/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/plone.testing-4.0.11-py2.7.egg/plone/testing/z2.py", line 261, in zopeApp
    transaction.commit()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_manager.py", line 89, in commit
    return self.get().commit()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 336, in commit
    t, v, tb = self._saveAndGetCommitishError()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 329, in commit
    self._commitResources()
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/transaction-1.1.1-py2.7.egg/transaction/_transaction.py", line 443, in _commitResources
    rm.commit(self)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 567, in commit
    self._commit(transaction)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 623, in _commit
    self._store_objects(ObjectWriter(obj), transaction)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/Connection.py", line 658, in _store_objects
    p = writer.serialize(obj)  # This calls __getstate__ of obj
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 422, in serialize
    return self._dump(meta, obj.__getstate__())
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 431, in _dump
    self._p.dump(state)
  File "/home/thet-data/dotfiles-thet/home/.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/serialize.py", line 352, in persistent_id
    "database connection", self._jar, obj,
InvalidObjectReference: ('Attempt to store an object from a foreign database connection', <Connection at 131c4610>, <collective.z3cform.datagridfield.registry.DictRow object at 0x40c8578>)
thet commented 10 years ago

fixed with: https://github.com/bluedynamics/bda.plone.ticketshop/commit/1482fbe99cbe4aced136a728c0bed4ba37358da5

looks like, we cannot depend on the shop layer because that seems to use different zodb connections.

frisi commented 6 years ago

i got a similar error in my unit tests when installing collective.cookiecuttr in a testcase's setUp method of multiple tests using the same layer. this might help people searching for this error message so i amend it to this closed ticket: https://community.plone.org/t/test-isolation-errors-with-collective-z3cform-datagridfield/7424