Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix injection of ZopeLite test configuration into the global Zope configuration. #65

Merged
merged 1 commit into from
Jun 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions news/65.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix injection of ZopeLite test configuration into the global Zope configuration.
Fixes #64
[thet]
6 changes: 5 additions & 1 deletion src/plone/testing/zope.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from plone.testing import zca
from plone.testing import zodb
from plone.testing._z2_testbrowser import Browser # noqa
from Testing.ZopeTestCase.ZopeLite import _patched as ZOPETESTCASEALERT
from webtest.http import StopableWSGIServer
from Zope2.App.schema import Zope2VocabularyRegistry
from zope.schema.vocabulary import getVocabularyRegistry
Expand Down Expand Up @@ -461,6 +460,11 @@ def setUpDatabase(self):
that the database that is opened by Zope 2 is in fact the top of
the resource stack.
"""

# NOTE: Keep that import here.
# Having it on module-level has the side effect of injecting the
# ZopeLite test configuration into the global Zope configuration.
from Testing.ZopeTestCase.ZopeLite import _patched as ZOPETESTCASEALERT
Copy link
Member Author

@thet thet Jul 1, 2019

Choose a reason for hiding this comment

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

I think we can remove this and the following lines all together?
Looking at it, I can't make sense of importing something and then throwing an error if the import was successful.
@datakurre @pbauer

Copy link
Member

Choose a reason for hiding this comment

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

I agree. It seems that running ZopeTestCase together with ours had side-effects that needed to be warned about. See 3268cda
I should hope that these issues are gone.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yes, that makes sense.
I remeber also, that was done at the Alpine City Sprint.

if ZOPETESTCASEALERT:
raise Exception('You try to run plone.testing tests together with '
'ZopeTestCase tests. This will result in random '
Expand Down