layer ordering detection is wrong
Bug #446073 reported by
Thomas Herve
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
zope.testing |
Won't Fix
|
Undecided
|
Unassigned | ||
zope.testrunner |
Invalid
|
Undecided
|
Unassigned |
Bug Description
On recent zope.testing, some layers are detected as non-supporting teardown whereas they do (like unittest layers), thus run in a subprocess. It generally slows down the tests, and it seems generally unnecessary. From my understanding it comes from 2 things:
* once one layer raises CanNotTearDown, all the subsequent layers are considered not supporting teardown.
* the layer ordering is incorrect. For example the unittest layer is almost always the last one.
I guess fixing the former may be tricky, but fixing the latter looks like a sane idea.
To post a comment you must log in.
I'm not sure I really understand what's going on in order_by_bases. I guess it always put the base classes before their children. It doesn't order layers between them, though.
The following patch puts the unittest layer first, but I suspect there may be a better fix:
=== modified file 'src/zope/ testing/ testrunner/ runner. py' testing/ testrunner/ runner. py 2009-10-07 17:53:44 +0000 testing/ testrunner/ runner. py 2009-10-08 06:56:29 +0000 layers( self):
layer_ names = dict([( layer_from_ name(layer_ name), layer_name)
for layer_name in self.tests_ by_layer_ name]) bases(layer_ names): testrunner. layer import UnitTests bases(layer_ names) index(UnitTests ): remove( UnitTests)
layer_ name = layer_names[layer] by_layer_ name[layer_ name]
--- src/zope/
+++ src/zope/
@@ -101,7 +101,12 @@
def ordered_
- for layer in order_by_
+ from zope.testing.
+ layers = order_by_
+ if UnitTests in layers and layers.
+ layers.
+ layers.insert(0, UnitTests)
+ for layer in layers:
yield layer_name, layer, self.tests_