[Checkins] SVN: manuel/branches/elro-test-count/src/manuel/testing.py zope.testrunner layer support
Laurence Rowe
l at lrowe.co.uk
Sat Aug 14 11:25:34 EDT 2010
Log message for revision 115678:
zope.testrunner layer support
Changed:
U manuel/branches/elro-test-count/src/manuel/testing.py
-=-
Modified: manuel/branches/elro-test-count/src/manuel/testing.py
===================================================================
--- manuel/branches/elro-test-count/src/manuel/testing.py 2010-08-14 10:25:35 UTC (rev 115677)
+++ manuel/branches/elro-test-count/src/manuel/testing.py 2010-08-14 15:25:34 UTC (rev 115678)
@@ -154,11 +154,21 @@
`TestCase`
The TestCase class to be used instead of manuel.testing.TestCase.
+ `layer`
+ A zope.testrunner layer object to be set on each TestCase.
+
+ `addLayerToGlobs`
+ Defaults to True. If `layer` is supplied add it to the `globs`.
"""
suite = unittest.TestSuite()
globs = kws.pop('globs', {})
TestCase_class = kws.pop('TestCase', TestCase)
+ layer = kws.pop('layer', None)
+ if layer is not None:
+ addLayerToGlobs = kws.pop('addLayerToGlobs', True)
+ if addLayerToGlobs and 'layer' not in globs:
+ globs['layer'] = layer
# walk up the stack frame to find the module that called this function
for depth in range(1, 5):
@@ -182,6 +192,9 @@
document.parse_with(m)
for regions in group_regions_by_test_case(document):
- suite.addTest(TestCase_class(m, regions, globs, **kws))
+ test = TestCase_class(m, regions, globs, **kws)
+ if layer is not None:
+ test.layer = layer
+ suite.addTest(test)
return suite
More information about the checkins
mailing list