Thursday, March 02, 2006

Nose: the road to 0.9

Nose, my little python test runner, has set foot (or, Simpson-philes, shopping cart wheel) on its mystical journey to version 0.9. Since it's gotten a bit more use and attention lately, I'm going to chronicle major changes in operation and APIs as I make them here, on this dusty old blog. First up, test selection via the command line. After too much mulling, I've decided that Titus Brown is right, and this: nosetests a.module Should discover all tests, but run only the test(s) specifed. To select a single test or test class, with nose 0.9, you'll be able to say: nosetests a.module:Class.method other.module:function I think that will be an improvement. The -f, -m and -o options will most likely be deprecated.

2 Comments:

Blogger Mark Mc Mahon said...

Hi,

Not sure if you got this suggestion previously - but as unit tests are supposed to run as fast as possible - it would be nice to have some simple profiling of the tests. For example you could specify some option that would just output how many seconds a particular test took to run.

Thanks
Mark

Otherwise it looks fine. I find that I am running tests from one directory and my current working directory is important.

for example I have
dir\package\subpackage
dir\package\unittests\testsarehere

in my tests I have
import package (but package is not on sys.path)

if I am in dir and run my unittests normally - they all pass.
With coverage.py - they all run except those that look at the __file__ attribute of the test (to load a data file I need)
With Nose - many fail (with a weird issue __init__ of a subclass calling
superclassmodule.superclass.__init__(self, args)

says that it is in error that superclass should be called with a first argument of itself!.

I didn't seem a mailing list of bug DB - so posting it here :-)

3:38 PM  
Blogger jhp said...

Mark,

Thanks for the feature request and bug report.

On the feature: I'm planning to add timing requirements to 0.9. Seems like adding timing output would be natural, too.

On the bug: I haven't seen behavior like what you describe myself. Would it be possible for you to send me more detail -- the best thing would be a small reproducing case and instructions for producing the error. You can send it to jpellerin+nose at gmail.com.

Thanks again.

10:25 PM  

Post a Comment

<< Home