Commit a529fd84 authored by Jim Fulton's avatar Jim Fulton

Fixed: An elaborate test for trvial logic corrupted module state in a

       way that made other tests fail spuriously.
parent b300f227
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
Change History Change History
================ ================
4.0.0a3 (2012-12-01)
=====================
Fixed: An elaborate test for trvial logic corrupted module state in a
way that made other tests fail spuriously.
4.0.0a2 (2012-11-13) 4.0.0a2 (2012-11-13)
===================== =====================
......
...@@ -11,55 +11,8 @@ ...@@ -11,55 +11,8 @@
# FOR A PARTICULAR PURPOSE. # FOR A PARTICULAR PURPOSE.
# #
############################################################################## ##############################################################################
def _noop(event):
"""
Tests:
>>> import sys, ZODB.event
>>> notify = ZODB.event
>>> zopemod = sys.modules.get('zope', False)
>>> event = sys.modules.get('zope.event', False)
>>> if event:
... del zopemod.event
... sys.modules['zope.event'] = None
... _ = reload(ZODB.event)
If zope.event isn't installed, then notify is _noop
>>> ZODB.event.notify is ZODB.event._noop
True
If zope.event is installed, then notify is zope.event.notify:
>>> zope = sys.modules['zope'] = type(sys)('zope')
>>> zope.event = sys.modules['zope.event'] = type(sys)('zope.event')
>>> zope.event.notify = lambda e: None
>>> _ = reload(ZODB.event)
>>> ZODB.event.notify is zope.event.notify
True
Cleanup:
>>> if event is False:
... del sys.modules['zope.event']
... else:
... if event:
... zopemod.event = event
... sys.modules['zope.event'] = event
>>> if zopemod is False:
... del sys.modules['zope']
... else:
... sys.modules['zope'] = zopemod
>>> ZODB.event.notify = notify
"""
pass
try: try:
from zope.event import notify from zope.event import notify
except ImportError: except ImportError:
notify = _noop notify = lambda event: None
...@@ -614,7 +614,6 @@ class PoisonedObject: ...@@ -614,7 +614,6 @@ class PoisonedObject:
def test_suite(): def test_suite():
return unittest.TestSuite(( return unittest.TestSuite((
unittest.makeSuite(ZODBTests, 'check'), unittest.makeSuite(ZODBTests, 'check'),
doctest.DocTestSuite('ZODB.event'),
)) ))
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment