[TIP] 2.6.3 unittest change breaks nose

jason pellerin jpellerin at gmail.com
Sat Jul 4 14:42:05 PDT 2009


> Why not just pass in your custom test runner?

nose's TestRunner needs more arguments than the default class. And
setting the default testRunner class in the arguments to __init__
wasn't the pattern in previous unittests. nose is old!  :)

> Monkey-patching TestProgram.runTests seems like a really bad idea...

I'm not being clear, I guess.. nose doesn't monkeypatch anything. It
overrides runTests() in the normal OO sense. nose has None as the
default for testRunner since that was the default in TestProgram for
all versions of unittest up until 2.6. It has the same check in
runTests() as those versions of unittest -- if self.testRunner is
None, set it to the default. (And then do a bunch of stuff with
plugins, etc). That works fine for everything from 2.3 to 2.6.2, but
the change in 2.6.3 sneaks an assignment to self.testRunner in between
nose's setting the default to None and where nose expects to see the
default, which is a new behavior for unittest.

> It's missing a patch... :-)

Heh. Yes, I guess it is. I'll add one in the next few days if nobody
beats me to it.

JP



More information about the testing-in-python mailing list