[SciPy-dev] Using nose

Anne Archibald peridot.faceted at gmail.com
Sat Oct 4 20:42:59 EDT 2008


2008/10/4 Alan McIntyre <alan.mcintyre at gmail.com>:
> On Sat, Oct 4, 2008 at 3:07 PM, Anne Archibald
> <peridot.faceted at gmail.com> wrote:
>> I have a particular pattern of tests I'd like to implement, and I
>> don't know a good way to make nose carry it out. The pattern is this:
>> I have a class with a setUp function that creates various variables
>> (an array of test data, etc.). I also have a handful of test_whatever
>> methods. This works fine. But now I'd like to apply exactly the same
>> test methods to a different set of data. My first attempt was to
>> simply create a derived class which overrode the setUp method, but
>> unfortunately neither unittest nor nose will run tests defined in the
>> parent class.
>
> Anne,
>
> If I understand correctly, I think you might be able to use a
> variation of this technique:
>
> http://projects.scipy.org/scipy/numpy/wiki/TestingGuidelines#creating-many-similar-tests
>
> Please let me know if that doesn't work (or if the doc isn't clear on
> something).

Aha! Thanks. This is pretty much what I tried to do, but there was a
bug in my code and so I assumed that nose behaved the same as unittest
in this.

Anne



More information about the SciPy-Dev mailing list