[Zope3-checkins] SVN: Zope3/trunk/ Make the ZCMLLayer tear down
support optional, disabled by default -- it breaks
Marius Gedminas
marius at pov.lt
Wed Jan 24 14:37:01 EST 2007
Log message for revision 72217:
Make the ZCMLLayer tear down support optional, disabled by default -- it breaks
3rd party apps, which is not nice.
Changed:
U Zope3/trunk/doc/CHANGES.txt
U Zope3/trunk/src/zope/app/container/testing.py
U Zope3/trunk/src/zope/app/testing/functional.py
U Zope3/trunk/src/zope/formlib/ftests.py
U Zope3/trunk/src/zope/testbrowser/ftests/testdoc.py
U Zope3/trunk/src/zope/traversing/ftests/layer.py
-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt 2007-01-24 16:28:15 UTC (rev 72216)
+++ Zope3/trunk/doc/CHANGES.txt 2007-01-24 19:37:00 UTC (rev 72217)
@@ -10,6 +10,11 @@
New features
+ - zope.app.testing.functional.ZCMLLayer supports in-process tearDown.
+ For backwards compatibility, this feature is disabled by default.
+ You can enable it by passing ``allow_teardown=True`` to ``ZCMLLayer()``
+ or to ``defineLayer()``.
+
- zope.app.generations now guarantees the order in which schema managers
are invoked, allowing frameworks and extensions to have a predictable
evolution relationship.
@@ -327,7 +332,7 @@
Much thanks to everyone who contributed to this release:
Jim Fulton, Dmitry Vasiliev, Martijn Faassen, Christian Theune, Wolfgang
- Schnerring, Fred Drake
+ Schnerring, Fred Drake, Marius Gedminas
------------------------------------------------------------------
Modified: Zope3/trunk/src/zope/app/container/testing.py
===================================================================
--- Zope3/trunk/src/zope/app/container/testing.py 2007-01-24 16:28:15 UTC (rev 72216)
+++ Zope3/trunk/src/zope/app/container/testing.py 2007-01-24 19:37:00 UTC (rev 72217)
@@ -3,5 +3,5 @@
AppContainerLayer = ZCMLLayer(
os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'),
- __name__, 'AppContainerLayer')
+ __name__, 'AppContainerLayer', allow_teardown=True)
Modified: Zope3/trunk/src/zope/app/testing/functional.py
===================================================================
--- Zope3/trunk/src/zope/app/testing/functional.py 2007-01-24 16:28:15 UTC (rev 72216)
+++ Zope3/trunk/src/zope/app/testing/functional.py 2007-01-24 19:37:00 UTC (rev 72217)
@@ -195,19 +195,26 @@
__bases__ = ()
- def __init__(self, config_file, module, name):
+ def __init__(self, config_file, module, name, allow_teardown=False):
self.config_file = config_file
self.__module__ = module
self.__name__ = name
+ self.allow_teardown = allow_teardown
def setUp(self):
self.setup = FunctionalTestSetup(self.config_file)
def tearDown(self):
self.setup.tearDownCompletely()
+ if not self.allow_teardown:
+ # Some ZCML directives change globals but are not accompanied
+ # with registered CleanUp handlers to undo the changes. Let
+ # packages which use such directives indicate that they do not
+ # support tearing down.
+ raise NotImplementedError
-def defineLayer(name, zcml='test.zcml'):
+def defineLayer(name, zcml='test.zcml', allow_teardown=False):
"""Helper function for defining layers.
Usage: defineLayer('foo')
@@ -217,6 +224,7 @@
os.path.join(os.path.split(globals['__file__'])[0], zcml),
globals['__name__'],
name,
+ allow_teardown=allow_teardown,
)
if os.path.exists(os.path.join('zopeskel', 'etc', 'ftesting.zcml')):
Modified: Zope3/trunk/src/zope/formlib/ftests.py
===================================================================
--- Zope3/trunk/src/zope/formlib/ftests.py 2007-01-24 16:28:15 UTC (rev 72216)
+++ Zope3/trunk/src/zope/formlib/ftests.py 2007-01-24 19:37:00 UTC (rev 72217)
@@ -22,7 +22,7 @@
FormlibLayer = functional.ZCMLLayer(
os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'),
- __name__, 'FormlibLayer')
+ __name__, 'FormlibLayer', allow_teardown=True)
def test_suite():
errors = functional.FunctionalDocFileSuite("errors.txt")
Modified: Zope3/trunk/src/zope/testbrowser/ftests/testdoc.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/ftests/testdoc.py 2007-01-24 16:28:15 UTC (rev 72216)
+++ Zope3/trunk/src/zope/testbrowser/ftests/testdoc.py 2007-01-24 19:37:00 UTC (rev 72217)
@@ -23,7 +23,7 @@
TestBrowserLayer = functional.ZCMLLayer(
os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'),
- __name__, 'TestBrowserLayer')
+ __name__, 'TestBrowserLayer', allow_teardown=True)
def test_suite():
flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
Modified: Zope3/trunk/src/zope/traversing/ftests/layer.py
===================================================================
--- Zope3/trunk/src/zope/traversing/ftests/layer.py 2007-01-24 16:28:15 UTC (rev 72216)
+++ Zope3/trunk/src/zope/traversing/ftests/layer.py 2007-01-24 19:37:00 UTC (rev 72217)
@@ -3,6 +3,6 @@
TraversingLayer = functional.ZCMLLayer(
os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'),
- __name__, 'TraversingLayer')
+ __name__, 'TraversingLayer', allow_teardown=True)
More information about the Zope3-Checkins
mailing list