After ignoring the testfailures in PLIP3211 (Mockup ES6) for a while ( ) I finally fixed the test setup.
I didn't thought that this would take me that long...
Tests were always failing with a similar strange error message like this one:
Traceback (most recent call last):
File "/home/_thet/data/dev/sprints/plone6ui/REPOS/buildout.coredev/src/plone.testing/src/plone/testing/zope.py", line 273, in zopeApp
app.REQUEST.close()
File "/home/_thet/data/dev/sprints/plone6ui/REPOS/buildout.coredev/src/Zope/src/ZPublisher/BaseRequest.py", line 215, in close
notify(EndRequestEvent(None, self))
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/zope.event-4.5.0-py3.9.egg/zope/event/__init__.py", line 32, in notify
subscriber(event)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/zope.component-4.6.2-py3.9.egg/zope/component/event.py", line 27, in dispatch
component_subscribers(event, None)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/zope.component-4.6.2-py3.9.egg/zope/component/_api.py", line 134, in subscribers
return sitemanager.subscribers(objects, interface)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/zope.interface-5.4.0-py3.9-linux-x86_64.egg/zope/interface/registry.py", line 448, in subscribers
return self.adapters.subscribers(objects, provided)
ZODB.POSException.POSKeyError: 'RequestContainer' object has no attribute 'adapters'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/zope.testrunner-5.4.0-py3.9.egg/zope/testrunner/runner.py", line 467, in run_layer
setup_layer(options, layer, setup_layers)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/zope.testrunner-5.4.0-py3.9.egg/zope/testrunner/runner.py", line 837, in setup_layer
setup_layer(options, base, setup_layers)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/zope.testrunner-5.4.0-py3.9.egg/zope/testrunner/runner.py", line 837, in setup_layer
setup_layer(options, base, setup_layers)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/zope.testrunner-5.4.0-py3.9.egg/zope/testrunner/runner.py", line 842, in setup_layer
layer.setUp()
File "/home/_thet/data/dev/sprints/plone6ui/REPOS/buildout.coredev/src/plone.app.testing/src/plone/app/testing/layers.py", line 106, in setUp
self.setUpDefaultContent(app)
File "/usr/lib/python3.9/contextlib.py", line 126, in __exit__
next(self.gen)
File "/home/_thet/data/dev/sprints/plone6ui/REPOS/buildout.coredev/src/plone.testing/src/plone/testing/zope.py", line 279, in zopeApp
raise inner_exception
File "/home/_thet/data/dev/sprints/plone6ui/REPOS/buildout.coredev/src/plone.testing/src/plone/testing/zope.py", line 268, in zopeApp
transaction.commit()
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/transaction-3.0.1-py3.9.egg/transaction/_manager.py", line 257, in commit
return self.manager.commit()
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/transaction-3.0.1-py3.9.egg/transaction/_manager.py", line 134, in commit
return self.get().commit()
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/transaction-3.0.1-py3.9.egg/transaction/_transaction.py", line 282, in commit
reraise(t, v, tb)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/transaction-3.0.1-py3.9.egg/transaction/_compat.py", line 49, in reraise
raise value
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/transaction-3.0.1-py3.9.egg/transaction/_transaction.py", line 273, in commit
self._commitResources()
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/transaction-3.0.1-py3.9.egg/transaction/_transaction.py", line 456, in _commitResources
reraise(t, v, tb)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/transaction-3.0.1-py3.9.egg/transaction/_compat.py", line 49, in reraise
raise value
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/transaction-3.0.1-py3.9.egg/transaction/_transaction.py", line 430, in _commitResources
rm.commit(self)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/ZODB-5.6.0-py3.9.egg/ZODB/Connection.py", line 492, in commit
self._commit_savepoint(transaction)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/ZODB-5.6.0-py3.9.egg/ZODB/Connection.py", line 1046, in _commit_savepoint
obj._p_estimated_size = len(data)
File "/home/_thet/data/dev/sprints/plone6ui/REPOS/buildout.coredev/src/Products.CMFPlone/Products/CMFPlone/Portal.py", line 69, in __setattr__
if self._tree is not None and name in self:
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/ZODB-5.6.0-py3.9.egg/ZODB/Connection.py", line 791, in setstate
p, serial = self._storage.load(oid)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/ZODB-5.6.0-py3.9.egg/ZODB/mvccadapter.py", line 153, in load
r = self._storage.loadBefore(oid, self._start)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/ZODB-5.6.0-py3.9.egg/ZODB/DemoStorage.py", line 225, in loadBefore
return self.base.loadBefore(oid, tid)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/ZODB-5.6.0-py3.9.egg/ZODB/DemoStorage.py", line 225, in loadBefore
return self.base.loadBefore(oid, tid)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/ZODB-5.6.0-py3.9.egg/ZODB/utils.py", line 288, in __call__
return func(*args, **kw)
File "/home/_thet/repos-config/dotfiles-thet/dot.buildout/eggs/ZODB-5.6.0-py3.9.egg/ZODB/MappingStorage.py", line 168, in loadBefore
raise ZODB.POSException.POSKeyError(oid)
ZODB.POSException.POSKeyError: 0x2bec75a38a64a63c
No fun involved wherever a POSKeyError pops up.
After unsuccessfully trying to understand the failure and hunting down the error with pdb without finding the cause I began to narrow down the problem on per repository basis.
There are already quite a few repositories involved, see: buildout.coredev/plip-3211-mockup-redone-source-checkouts.cfg at 6.0 · plone/buildout.coredev · GitHub
I could identify the failure in two repositories: Products.CMFPlone and plone.staticresources.
In CMFPlone the problem was the removed exportimport handler for the resource registry, which was removed when switching to the webresource-based resource registry (which is awesome).
The fix is here: TMP - Fixes test setup for yet unknown reason. · plone/Products.CMFPlone@3e9ab29 · GitHub
In plone.staticresources the problem was the removed registration of the plone-logged-in bundle, this is the fix: TMP - Fixes test setup for yet unknown reason. · plone/plone.staticresources@48a14ee · GitHub
I do absolutely not understand why this is happening.
Do we have a hidden ZODB in our test environment which expects some code to be exactly there as-is?
For example, in the CMFPlone exportimport hander: When trying to remove function bodies or even just add a print statement (!) within the involved functions, the tests broke again with the mentioned POSKeyError
That is the reason why I did not / could not narrow down the function bodies to a dummy function which only keeps the original function signature. The same goes for the plone-logged-in-compiled.min.js which I had to include as full JavaScript file.
If anyone can shed a little light on this, I'd be a little more happier about this.