[TIP] 2.6.3 unittest change breaks nose

Michael Foord fuzzyman at voidspace.org.uk
Sat Jul 4 12:06:57 PDT 2009

Barry Warsaw wrote:
> On Jul 4, 2009, at 12:38 PM, jason pellerin wrote:
>> This changeset:
>> http://hg.python.org/cpython/rev/c3fb79d1c036
>> breaks nose, as it changes the behavior of unittest.TestProgram in a
>> non-backwards-compatible way. Previously, when called like:
>> TestProgram(testRunner=None)
>> self.testRunner would be None when runTests() was called. Now, it is
>> immediately populated with the default TextTestRunner class. nose
>> expects self.testRunner to be None or a runner instance in runTests(),
>> and thus fails immediately with 2.6.3.
> Please submit a bug report on this, if there isn't one already.  You 
> can make it a release blocker for 2.6.4.

Well this change was made to fix a regression in 2.6.

In 2.5 the default was None and someone (else) made the also backwards 
incompatible change to make the default the TextTestRunner class. This 
broke test suites (like setuptools for example) which expected to be 
able to pass None in and get sensible default behaviour.

The change can't be reverted as it was a bugfix, but a different change 
could be applied. Is nose actually modifying the behaviour of 
TestProgram.runTests ? That isn't intended to be used directly except 
through main - and tying yourself very closely to its implementation 
details seems like a recipe for this kind of problem.

To be honest I'd like to blow TestProgram away altogether and replace it 
with a *sensible* set of functions.


> -Barry
> ------------------------------------------------------------------------
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python


More information about the testing-in-python mailing list