[Checkins]
SVN: grokcore.view/trunk/src/grokcore/view/tests/test_all.py
Cleaning up in a layer's tearDown means clean up will happen
exactly once: when the
Philipp von Weitershausen
philikon at philikon.de
Sat Jul 19 22:26:56 EDT 2008
Log message for revision 88632:
Cleaning up in a layer's tearDown means clean up will happen exactly once: when the
layer is torn down. This is unacceptable for unit tests. You want to clean up after
every unit test.
Let's keep doing what grok.tests.test_grok does.
Changed:
U grokcore.view/trunk/src/grokcore/view/tests/test_all.py
-=-
Modified: grokcore.view/trunk/src/grokcore/view/tests/test_all.py
===================================================================
--- grokcore.view/trunk/src/grokcore/view/tests/test_all.py 2008-07-20 02:21:34 UTC (rev 88631)
+++ grokcore.view/trunk/src/grokcore/view/tests/test_all.py 2008-07-20 02:26:55 UTC (rev 88632)
@@ -1,23 +1,15 @@
-# -*- coding: utf-8 -*-
import re
import unittest
from pkg_resources import resource_listdir
-
from zope.testing import doctest, cleanup, renormalizing
import zope.component.eventtesting
+def setUpZope(test):
+ zope.component.eventtesting.setUp(test)
-class GrokcoreViewLayer:
+def cleanUpZope(test):
+ cleanup.cleanUp()
- @classmethod
- def setUp(cls):
- zope.component.eventtesting.setUp()
-
- @classmethod
- def tearDown(cls):
- cleanup.cleanUp()
-
-
checker = renormalizing.RENormalizing([
# str(Exception) has changed from Python 2.4 to 2.5 (due to
# Exception now being a new-style class). This changes the way
@@ -41,10 +33,11 @@
dottedname = ('grokcore.view.tests.%s.%s'
% (name, filename[:-3]))
test = doctest.DocTestSuite(dottedname,
+ setUp=setUpZope,
+ tearDown=cleanUpZope,
checker=checker,
optionflags=doctest.ELLIPSIS+
doctest.NORMALIZE_WHITESPACE)
- test.layer = GrokcoreViewLayer
suite.addTest(test)
return suite
@@ -54,6 +47,3 @@
for name in ['template', 'static', 'view', 'security']:
suite.addTest(suiteFromPackage(name))
return suite
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
More information about the Checkins
mailing list