summaryrefslogtreecommitdiff
path: root/doc/source/contributor/testing.rst
blob: afb0e72ec4ebd97c7e0fc16f1b8274769ea7cbb1 (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
..
      Except where otherwise noted, this document is licensed under Creative
      Commons Attribution 3.0 License.  You can view the license at:

          https://creativecommons.org/licenses/by/3.0/

=======
Testing
=======

.. _unit_tests:

Unit tests
==========

All unit tests should be run using `tox`_. To run the same unit tests that are
executing onto `Gerrit`_ which includes ``py35``, ``py27`` and ``pep8``, you
can issue the following command::

    $ workon watcher
    (watcher) $ pip install tox
    (watcher) $ cd watcher
    (watcher) $ tox

If you want to only run one of the aforementioned, you can then issue one of
the following::

    $ workon watcher
    (watcher) $ tox -e py35
    (watcher) $ tox -e py27
    (watcher) $ tox -e pep8

.. _tox: https://tox.readthedocs.org/
.. _Gerrit: http://review.openstack.org/

You may pass options to the test programs using positional arguments. To run a
specific unit test, you can pass extra options to `os-testr`_ after putting
the ``--`` separator. So using the ``-r`` option followed by a regex string,
you can run the desired test::

    $ workon watcher
    (watcher) $ tox -e py27 -- -r watcher.tests.api

.. _os-testr: http://docs.openstack.org/developer/os-testr/

When you're done, deactivate the virtualenv::

    $ deactivate

.. _tempest_tests:

Tempest tests
=============

Tempest tests for Watcher has been migrated to the external repo
`watcher-tempest-plugin`_.

.. _watcher-tempest-plugin: https://github.com/openstack/watcher-tempest-plugin