[TIP] getting access to the discovered test list

jason pellerin jpellerin at gmail.com
Wed Feb 28 17:34:32 PST 2007


On 2/28/07, bear <bear42 at gmail.com> wrote:
> What we are doing is giving the developer the normal "run all unit tests"
> option which runs them all using the same python instance that was used to
> start nose.  But a request was made to also be able to gather the list of
> tests and then start each test in its own python - that way any errant code
> won't pollute the environment for downstream tests.

Hm -- interesting. I'm not sure of the best way to do exactly that
with nose. You could write a plugin that implements wantClass to
always return False (to prevent normal loading), and
loadTestsFromTestCase to wrap each test case in a fork/exec and parse
the output so you can figure out whether it passed or failed and pass
that to the result.

> Having read the code just now it looks like I can use my custom test loader
> in the same way with nose.

Or you could try that. :) Let me know if it works or how it fails if
it fails. nose's loader in the 0.9 series is not quite drop-in
compatible with unittest's, so dropping yours into nose may not work
the way you expect. If it doesn't, it would be very helpful if you
could file a bug report here:
http://code.google.com/p/python-nose/issues/list. Thanks and good
luck. :)

JP



More information about the testing-in-python mailing list