Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Equivalent to Perl's prove

I am working on a tdd project in python and I am looking for a quick way to run all unit tests in my t/ directory. In perl this is easy:

$ prove -lvr t/ 

I am looking for the python equivalent. It does not seem that nose has this functionality. I rolled a command line statement to do something like this:

for x in `find t/ | grep py`; do echo $x && python $x ; done

But this lacks flags like -l (include the local lib dir) and -v (verbose). Does this or does this not exist in python? I want a one liner like this:

$ pyprove -lvr t/
like image 403
David Williams Avatar asked Sep 03 '26 22:09

David Williams


1 Answers

You can do this by running python -m unittest discover -s t/, which will discover your unit tests and run them for you. It looks like there's a verbose flag, but I don't see a flag to include the local lib dir.

like image 157
girasquid Avatar answered Sep 06 '26 11:09

girasquid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!