[TIP] Nose Test Discovery - Am I doing it wrong?

Michael Foord fuzzyman at voidspace.org.uk
Tue Dec 2 02:48:52 PST 2008


Casey McGinty wrote:
> Please tell if this is correct behavior when using nose. Assume I have 
> a python file called 'myscript.py':
>
> $ ls .
>    myscript.py
>    ...
>
> $ cat myscript.py
> def test():
>     pass
>
> $ nosetests
> ----------------------------------------------------------------------
> Ran 0 tests in 0.006s
>
> OK
>
> Why doesn't nose run my test in my script file?
>

Nose is looking for test files - by default I *think* it expects 'test' 
to appear in the filename (either at the start or the end before the 
'.py' - I'm not actually a nose user).

Try putting a print in 'myscript.py' and I think you will find that it 
is not being executed by nose at all.

Michael Foord

> Thanks.
> ------------------------------------------------------------------------
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>   


-- 
http://www.ironpythoninaction.com/




More information about the testing-in-python mailing list