The wheezy documentation has a good example of how to do this with nose . The important part, if you just want to have timings, is to use the -q options to run -s , -s to not capture output (so you'll see the report output) and -m benchmark to run only 'time'.
I recommend using py.test for testing. To run an example from wheezy with this, change the name of the runTest method to test_bench_run and run only this test with:
py.test -qs -k test_bench benchmark_hello.py
( -q and -s , which have the same effect as the nose, and -k to select a test name pattern).
If you put your test tests in a file in a separate file or directory from ordinary tests, they are, of course, easier to select and do not need special names.
source share