[TIP] getting access to the discovered test list

bear bear42 at gmail.com
Wed Feb 28 15:39:41 PST 2007


On 2/28/07, jason pellerin <jpellerin at gmail.com> wrote:
>
> On 2/28/07, bear <bear42 at gmail.com> wrote:
> > One of the features I was adding to our custom test runner required me
> > building a list of all tests.  I had created my own test loader that
> made a
> > copy of the found TestCase objects.
> >
> > Is there a way for me to access the test list within nose?
>
> Not with the current version. The loading is all very lazy, so the
> list of tests that will be run is only know once the tests have all
> been run. Future versions (0.10 specifically) will be better about
> this, but future versions are a long way off.
>
> Of course you can do nosetest -v and get a list of all the tests that
> were run, but I don't think that's what you're after... Maybe if you
> can describe a bit what you need the test list for, I can suggest some
> better options.
>

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.

So what I have done is run the loader code to build a list of TestCase
instances and then cycle thru that list calling "python run_test <insert
name of test here>"

We realize that we shouldn't have tests that cause such pollution but once
we found one that did we wanted a way to verify a test run failed but not
because of the environment (I hope that makes sense.)

Having read the code just now it looks like I can use my custom test loader
in the same way with nose.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/testing-in-python/attachments/20070228/2f303196/attachment.htm 


More information about the testing-in-python mailing list