[issue9926] Wrapped TestSuite subclass does not get __call__ executed

Michael Foord report at bugs.python.org
Thu Sep 23 17:46:45 CEST 2010


Michael Foord <michael at voidspace.org.uk> added the comment:

Right, _wrapped_run is private and not intended to be overridden. 

Perhaps slightly ironically (for this particular bug report) is that the change was introduced to support class and module level setUp and tearDown (similar to the use-case it now blocks).

Another workaround would be to inherit from BaseTestSuite (which would disable the class and module level fixture support).

A backwards compatible change would be to rename BaseTestSuite *back* to TestSuite and give the current TestSuite a new name. This means that the new class / module level fixtures would only be supported in code that gets suites from the TestLoader (which uses the new class) or by creating suites using the new class.

The disadvantage of this approach is that it is not uncommon for test frameworks to create suites themselves - and doing this could 'break' tests using class / module fixtures.

The reason for the change is that in order to tearDown the final class and module level fixtures we need to know when we exit the 'top level' of a run from inside a suite.

Any other suggestions or ideas?

(Another idea is to add explicit setUp and tearDown hooks to the TestSuite object. This isn't backwards compatible but meets the direct use case. Obviously backwards compatibility is greatly preferable.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9926>
_______________________________________


More information about the Python-bugs-list mailing list