Skip to content

Commit

Permalink
Merge pull request #49 from plone/fix-zserver-exception-hook
Browse files Browse the repository at this point in the history
Fix the Zope exception hook when using the ZServer layer.
  • Loading branch information
davisagli committed Jun 22, 2018
2 parents 0c4c439 + 084d316 commit cc2f063
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Bug fixes:

- Fix most of the code smells Jenkins complains about.

- Fix the Zope exception hook when using the ZServer layer.


6.0.0 (2018-02-05)
------------------
Expand Down
11 changes: 11 additions & 0 deletions src/plone/testing/z2.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,7 @@ def setUp(self):

self._shutdown = False

self.setUpExceptionHook()
self.setUpServer()

self.thread = Thread(
Expand All @@ -1006,10 +1007,20 @@ def tearDown(self):
time.sleep(0.5)

self.tearDownServer()
self.tearDownExceptionHook()

del self['host']
del self['port']

def setUpExceptionHook(self):
from ZServer.ZPublisher.exceptionhook import EXCEPTION_HOOK
import Zope2
Zope2.zpublisher_exception_hook = EXCEPTION_HOOK

def tearDownExceptionHook(self):
import Zope2
Zope2.zpublisher_exception_hook = None

def setUpServer(self):
"""Create a ZServer server instance and save it in self.zserver
"""
Expand Down

1 comment on commit cc2f063

@jenkins-plone-org
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davisagli Jenkins CI reporting about code analysis
See the full report here: https://jenkins.plone.org/job/package-plone.testing/85/violations

src/plone/testing/z2.py:98:1: C901 'uninstallProduct' is too complex (15)
src/plone/testing/z2.py:138:19: T000 Todo note found.
src/plone/testing/z2.py:414:5: C901 'Startup.setUpPatches' is too complex (11)
src/plone/testing/z2.py:829:11: T000 Todo note found.

Follow these instructions to reproduce it locally.

Please sign in to comment.