File: README.rst

package info (click to toggle)
python-nose-timer 0.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 88 kB
  • sloc: python: 190; makefile: 18
file content (95 lines) | stat: -rw-r--r-- 2,679 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
nose-timer
==========

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

.. image:: https://travis-ci.org/mahmoudimus/nose-timer.png?branch=master
   :target: https://travis-ci.org/mahmoudimus/nose-timer


Install
-------

.. code::

   pip install nose-timer


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):

.. code:: bash

   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
``--timer-top-n`` flag.

.. code:: bash

   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 red.


How do I increase timer verbosity?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default nose-timer outputs test times at the end of all tests.
You can output test times after each test with ``--timer-verbose`` flag.
Note that ``--vv`` should be enabled as well to view info logs.

.. code:: bash

    nosetests --with-timer --timer-verbose -vv .


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
------------

- `@mahmoudimus <https://github.com/mahmoudimus>`_
- `@fisadev <https://github.com/fisadev>`_
- `@andresriancho <https://github.com/andresriancho>`_
- `@e0ne <https://github.com/e0ne>`_
- `@kevinburke <https://github.com/kevinburke>`_
- `@DmitrySandalov <https://github.com/DmitrySandalov>`_
- `@satyrius <https://github.com/satyrius>`_
- `@skudriashev <https://github.com/skudriashev>`_