testing - Python benchmark tool like nosetests? -


what want

i create set of benchmarks python project. see performance of these benchmarks change introduce new code. in same way test python, running utility command nosetests , getting nicely formatted readout.

what nosetests

the nosetests tool works searching through directory structure functions named test_foo.py , runs functions test_bar() contained within. runs of functions , prints out whether or not raised exception.

i'd similar searched files bench_foo.py , ran contained functions bench_bar() , reported runtimes.

questions

does such tool exist?

if not starting points? of nose source appropriate this?

the wheezy documentation has example on how nose. important part if want have timings use options -q quiet run, -s not capturing output (so see output of report) , -m benchmark run 'timing' tests.

i recommend using py.test testing over. run example wheezy that, change name of runtest method test_bench_run , run benchmark with:

py.test -qs -k test_bench benchmark_hello.py 

(-q , -s having same effect nose , -k select pattern of test names).

if put benchmark tests in file in separate file or directory normal tests of course more easy select , don't need special names.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -