Browser tests crash opening not found URL
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3
- Forks
- 9
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 3
Description
I have this patch:
diff --git a/Products/CMFPlone/tests/test_redirect_after_login.py b/Products/CMFPlone/tests/test_redirect_after_login.py
index 4552a508d..ab33a7a91 100644
--- a/Products/CMFPlone/tests/test_redirect_after_login.py
+++ b/Products/CMFPlone/tests/test_redirect_after_login.py
@@ -205,6 +205,10 @@ class TestRedirectAfterLogin(unittest.TestCase):
"Logout status message not displayed.",
)
+ def test_zzzz(self):
+ breakpoint()
+ self.browser.open('http://nohost/plone/bogus')
+
def test_password_reset_uses_all_adapters(self):
# By default, when you reset your password, you are directly logged in.
# An initial login adapter should be active.
When I run the silly test_zzzz with buildout.coredev I see:
(Pdb++) self.browser
<plone.testing._z2_testbrowser.Browser object at 0x7ff86590aa90>
(Pdb++) self.browser.open('http://nohost/plone/bogus')
*** ZODB.POSException.ConnectionStateError: Shouldn't load state for persistent.list.PersistentList 0x3b676fdf706dc1a7 when the connection is closed
Traceback (most recent call last):
File "/home/ale/.buildout/eggs/cp311/zope.testbrowser-5.6.1-py3.11.egg/zope/testbrowser/browser.py", line 256, in open
self._processRequest(url, make_request)
File "/home/ale/.buildout/eggs/cp311/zope.testbrowser-5.6.1-py3.11.egg/zope/testbrowser/browser.py", line 282, in _processRequest
resp = make_request(reqargs)
File "/home/ale/.buildout/eggs/cp311/zope.testbrowser-5.6.1-py3.11.egg/zope/testbrowser/browser.py", line 253, in make_request
return self.testapp.get(url, **args)
File "/home/ale/.buildout/eggs/cp311/WebTest-3.0.0-py3.11.egg/webtest/app.py", line 324, in get
return self.do_request(req, status=status,
File "/home/ale/.buildout/eggs/cp311/zope.testbrowser-5.6.1-py3.11.egg/zope/testbrowser/browser.py", line 93, in do_request
response = super(TestbrowserApp, self).do_request(req, status,
File "/home/ale/.buildout/eggs/cp311/WebTest-3.0.0-py3.11.egg/webtest/app.py", line 620, in do_request
res = req.get_response(app, catch_exc_info=True)
File "/home/ale/.buildout/eggs/cp311/WebOb-1.8.7-py3.11.egg/webob/request.py", line 1309, in send
status, headers, app_iter, exc_info = self.call_application(
File "/home/ale/.buildout/eggs/cp311/WebOb-1.8.7-py3.11.egg/webob/request.py", line 1278, in call_application
app_iter = application(self.environ, start_response)
File "/home/ale/.buildout/eggs/cp311/WebTest-3.0.0-py3.11.egg/webtest/lint.py", line 196, in lint_app
iterator = application(environ, start_response_wrapper)
File "/home/ale/.buildout/eggs/cp311/plone.testing-8.0.3-py3.11.egg/plone/testing/_z2_testbrowser.py", line 39, in wrapped_func
return func(*args, **kw)
File "/home/ale/.buildout/eggs/cp311/plone.testing-8.0.3-py3.11.egg/plone/testing/_z2_testbrowser.py", line 66, in __call__
wsgi_result = publish(environ, start_response)
File "/home/ale/Code/plone/projects/coredev/6.1/src/Zope/src/ZPublisher/WSGIPublisher.py", line 405, in publish_module
request.close()
File "/home/ale/Code/plone/projects/coredev/6.1/src/Zope/src/ZPublisher/BaseRequest.py", line 215, in close
notify(EndRequestEvent(None, self))
File "/home/ale/.buildout/eggs/cp311/zope.event-4.6-py3.11.egg/zope/event/__init__.py", line 33, in notify
subscriber(event)
File "/home/ale/.buildout/eggs/cp311/zope.component-5.1.0-py3.11.egg/zope/component/event.py", line 27, in dispatch
component_subscribers(event, None)
File "/home/ale/.buildout/eggs/cp311/zope.component-5.1.0-py3.11.egg/zope/component/_api.py", line 134, in subscribers
return sitemanager.subscribers(objects, interface)
File "/home/ale/.buildout/eggs/cp311/zope.interface-6.0-py3.11-linux-x86_64.egg/zope/interface/registry.py", line 445, in subscribers
return self.adapters.subscribers(objects, provided)
File "/home/ale/.buildout/eggs/cp311/zope.interface-6.0-py3.11-linux-x86_64.egg/zope/interface/adapter.py", line 892, in subscribers
subscriptions = self.subscriptions([providedBy(o) for o in objects], provided)
File "/home/ale/.buildout/eggs/cp311/zope.interface-6.0-py3.11-linux-x86_64.egg/zope/interface/adapter.py", line 874, in _uncached_subscriptions
if order >= len(byorder):
File "/usr/lib/python3.11/collections/__init__.py", line 1235, in __len__
return len(self.data)
File "/home/ale/.buildout/eggs/cp311/ZODB-5.8.0-py3.11.egg/ZODB/Connection.py", line 782, in setstate
raise ConnectionStateError(msg)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with test_zzzz in Products/CMFPlone/tests/test_redirect_after_login.py and trace the request through plone/testing/_z2_testbrowser.py, especially the request.close path shown in the traceback. Done means opening the bogus URL no longer raises ZODB.POSException.ConnectionStateError in the browser test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100