summaryrefslogtreecommitdiff
path: root/docs/dev/tests.rst
blob: 7f5fbaaf8a8c2a485d09bf805d9a6d7f84b43d49 (plain)
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
.. _tests:

Running and writing tests
=========================

.. note::
   should include seeAlso to virtualenv

This section covers the documentation about the tests for the LEAP Client code.
All patches should have tests for them ...


Testing dependencies
--------------------

have a look at ``pkg/test-requirements.pip``
The ``./run_tests.sh`` command should install all of them in your virtualenv for you.

If you prefer to install them system wide, this should do in a debian system::

    $ apt-get install python-nose python-mock python-coverage


Running tests
-------------

There is a convenience script at ``./run_tests.sh``

If you want to run specific tests, pass the (sub)module to nose::

  $ nosetests leap.util

or::

  $ nosetests leap.util.tests.test_leap_argparse

Hint: colorized output
^^^^^^^^^^^^^^^^^^^^^^

Install ``rednose`` locally, export the ``NOSE_REDNOSE`` variable, and give your eyes a rest :)::

  (leap_client)% pip install rednose
  (leap_client)% export NOSE_REDNOSE=1

Testing all the supported python versions
-----------------------------------------

For running testsuite against all the supported python versions (currently 2.6 and 2.7), run::

  % tox -v

Coverage reports
----------------

Pass the ``-c`` flat to the ``run_tests.sh`` script::

    $ run_tests.sh -c

Using ``coverage`` it will generate beautiful html reports that you can access pointing your browser to ``docs/covhtml/index.html``

.. note::
   The coverage reports will not be generated if all tests are not passing.