[Zodb-checkins] SVN: ZODB/trunk/src/Z Added layer declarations to take advantage of the test runner's
Jim Fulton
jim at zope.com
Fri Nov 14 18:08:42 EST 2008
Log message for revision 92951:
Added layer declarations to take advantage of the test runner's
ability to run layers in parallel. This reduces test run time my more
than 75% for me.
Changed:
U ZODB/trunk/src/ZEO/tests/testConnection.py
U ZODB/trunk/src/ZEO/tests/testZEO.py
U ZODB/trunk/src/ZODB/tests/util.py
-=-
Modified: ZODB/trunk/src/ZEO/tests/testConnection.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testConnection.py 2008-11-14 23:08:40 UTC (rev 92950)
+++ ZODB/trunk/src/ZEO/tests/testConnection.py 2008-11-14 23:08:42 UTC (rev 92951)
@@ -22,6 +22,7 @@
# Import the actual test class
from ZEO.tests import ConnectionTests, InvalidationTests
from zope.testing import doctest, setupstack
+import ZODB.tests.util
class FileStorageConfig:
def getConfig(self, path, create, read_only):
@@ -139,6 +140,7 @@
'invalidations_while_connecting.test',
setUp=setupstack.setUpDirectory, tearDown=setupstack.tearDown,
))
+ suite.layer = ZODB.tests.util.MininalTestLayer('ZEO Connection Tests')
return suite
Modified: ZODB/trunk/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testZEO.py 2008-11-14 23:08:40 UTC (rev 92950)
+++ ZODB/trunk/src/ZEO/tests/testZEO.py 2008-11-14 23:08:42 UTC (rev 92951)
@@ -1099,10 +1099,13 @@
def test_suite():
suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(ZODB.tests.util.AAAA_Test_Runner_Hack))
suite.addTest(doctest.DocTestSuite(
setUp=zope.testing.setupstack.setUpDirectory,
tearDown=zope.testing.setupstack.tearDown))
- suite.addTest(doctest.DocFileSuite('registerDB.test'))
+ suite.addTest(doctest.DocFileSuite(
+ 'registerDB.test'
+ ))
suite.addTest(
doctest.DocFileSuite('zeo-fan-out.test',
setUp=zope.testing.setupstack.setUpDirectory,
@@ -1111,6 +1114,7 @@
)
for klass in test_classes:
sub = unittest.makeSuite(klass, "check")
+ sub.layer = ZODB.tests.util.MininalTestLayer(klass.__name__)
suite.addTest(sub)
return suite
Modified: ZODB/trunk/src/ZODB/tests/util.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/util.py 2008-11-14 23:08:40 UTC (rev 92950)
+++ ZODB/trunk/src/ZODB/tests/util.py 2008-11-14 23:08:42 UTC (rev 92951)
@@ -61,3 +61,33 @@
def __repr__(self):
return 'P(%s)' % self.name
+
+class MininalTestLayer:
+
+ __bases__ = ()
+ __module__ = ''
+ def __init__(self, name):
+ self.__name__ = name
+
+ def setUp(self):
+ self.here = os.getcwd()
+ self.tmp = tempfile.mkdtemp(self.__name__, dir=os.getcwd())
+ os.chdir(self.tmp)
+
+ def tearDown(self):
+ os.chdir(self.here)
+ zope.testing.setupstack.rmtree(self.tmp)
+
+ testSetUp = testTearDown = lambda self: None
+
+class AAAA_Test_Runner_Hack(unittest.TestCase):
+ """Hack to work around a bug in the test runner.
+
+ The first later (lex sorted) is run first in the foreground
+ """
+
+ layer = MininalTestLayer('!no tests here!')
+
+ def testNothing(self):
+ pass
+
More information about the Zodb-checkins
mailing list