[Checkins] SVN: z3c.ptcompat/trunk/ - Fixed test tear down so tests can be run multiple times.
Michael Howitz
mh at gocept.com
Thu Nov 25 02:50:13 EST 2010
Log message for revision 118575:
- Fixed test tear down so tests can be run multiple times.
Changed:
U z3c.ptcompat/trunk/CHANGES.txt
U z3c.ptcompat/trunk/src/z3c/ptcompat/tests/test_doctests.py
-=-
Modified: z3c.ptcompat/trunk/CHANGES.txt
===================================================================
--- z3c.ptcompat/trunk/CHANGES.txt 2010-11-24 19:04:53 UTC (rev 118574)
+++ z3c.ptcompat/trunk/CHANGES.txt 2010-11-25 07:50:12 UTC (rev 118575)
@@ -6,7 +6,9 @@
- Added not yet declared test dependency on ``zope.testing``.
+- Fixed test tear down so tests can be run multiple times.
+
0.5.6 (2010-04-19)
------------------
Modified: z3c.ptcompat/trunk/src/z3c/ptcompat/tests/test_doctests.py
===================================================================
--- z3c.ptcompat/trunk/src/z3c/ptcompat/tests/test_doctests.py 2010-11-24 19:04:53 UTC (rev 118574)
+++ z3c.ptcompat/trunk/src/z3c/ptcompat/tests/test_doctests.py 2010-11-25 07:50:12 UTC (rev 118575)
@@ -1,13 +1,15 @@
-import zope.interface
-import zope.component
-
+import doctest
import os
+import os.path
import unittest
-import doctest
+import zope.component
+import zope.interface
+
OPTIONFLAGS = (doctest.ELLIPSIS |
doctest.NORMALIZE_WHITESPACE)
+
import zope.component.testing
import zope.configuration.xmlconfig
@@ -25,6 +27,12 @@
def tearDown(test):
zope.component.testing.tearDown(test)
+ compiled_file = os.path.join(os.path.dirname(__file__), 'test.pt.py')
+ if os.path.exists(compiled_file):
+ # this file leads to an ImportError on the next test run, so we
+ # delete it as it was generated an can be regenerated by the next
+ # test run
+ os.unlink(compiled_file)
def test_suite():
import z3c.ptcompat.tests
@@ -35,7 +43,7 @@
path=path,
interface=zope.interface,
component=zope.component)
-
+
return unittest.TestSuite([
doctest.DocFileSuite(
"zcml.txt",
@@ -44,6 +52,3 @@
setUp=setUp,
tearDown=tearDown,
package="z3c.ptcompat")])
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
More information about the checkins
mailing list