RETIRED, further work has moved to Debian project infrastructure
Go to file
Stanislav Kudriashev d622f4e618 Update version to 0.5.0 2015-07-20 18:07:23 +03:00
nosetimer Fix multiprocessing issues 2015-07-20 18:03:40 +03:00
tests Implement --timer-filter switch 2015-07-19 20:57:21 +03:00
.gitignore Updated LICENSE, added contributors, fixed readme, bumped version - getting ready for pypy release 2013-09-24 09:30:05 -07:00
.travis.yml Add PyPy3 test environment 2014-12-08 13:11:22 +02:00
LICENSE Updated LICENSE, added contributors, fixed readme, bumped version - getting ready for pypy release 2013-09-24 09:30:05 -07:00
MANIFEST.in Fix name of LICENSE file in MANIFEST.in 2014-12-01 23:49:50 +02:00
README.rst Implement --timer-filter switch 2015-07-19 20:57:21 +03:00
setup.py Update version to 0.5.0 2015-07-20 18:07:23 +03:00
tox.ini Add PyPy3 test environment 2014-12-08 13:11:22 +02:00

README.rst

nose-timer

A timer plugin for nosetests that answers the question: how much time does every test take?

image

Install

To install the latest release from PyPI:

pip install nose-timer

Or to install the latest development version from Git:

pip install git+git://github.com/mahmoudimus/nose-timer.git

Or to install the latest from source:

git clone https://github.com/mahmoudimus/nose-timer.git
cd nose-timer
python setup.py install

Usage

Run nosetests with the --with-timer flag, and you will see a list of the tests and the time spent by each one (in seconds):

myapp.tests.ABigTestCase.test_the_world_is_running: 56.0010s
myapp.tests.ABigTestCase.test_the_rest_of_the_galaxy_is_running: 2356.0010s

How do I show only the n slowest tests?

For example, to show only the 10 slowest tests, run nosetests with the --timer-top-n flag:

nosetests --with-timer --timer-top-n 10

How do I color the output and have pretty colors?

You can highlight slower tests using --timer-ok and --timer-warning flags. Default time unit is the second, but you can specify it explicitly, e.g. 1s, 100ms.

  • Tests which take less time than --timer-ok will be highlighted in green.
  • Tests which take less time than --timer-warning will be highlighted in yellow.
  • All other tests will be highlighted in red.

How do I turn off pretty colors?

In some cases, you may want to disable colors completely. This is done by using the --timer-no-color flag. This is useful when running tests in a headless console.

How do I filter results by colors?

It is possible to filter results by color. To do so, you can use the --timer-filter flag:

nosetests --with-timer --timer-filer ok
nosetests --with-timer --timer-filer warning
nosetests --with-timer --timer-filer error

Or to apply several filters at once:

nosetests --with-timer --timer-filer warning,error

License

nose-timer is an MIT/BSD dual-Licensed library.

Contribute

  • Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
  • Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).
  • Write a test which shows that the bug was fixed or that the feature works as expected.
  • Send a pull request and bug the maintainer until it gets merged and published.
  • Make sure to add yourself to the author's file in setup.py and the Contributors section below :)

Contributors