Add detailed unit test documentation for watcher

Change-Id: Ife4771707223351a84941b462d853c5e49ff55a5
This commit is contained in:
chenke 2018-11-05 10:48:33 +08:00
parent 59cae3268e
commit d6dc5675e3
1 changed files with 18 additions and 25 deletions

View File

@ -13,39 +13,32 @@ Testing
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::
All unit tests should be run using `tox`_. Before running the unit tests, you
should download the latest `watcher`_ from the github. 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
$ git clone https://git.openstack.org/openstack/watcher
$ cd watcher
$ pip install tox
$ tox
If you want to only run one of the aforementioned, you can then issue one of
If you only want to 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 -e py35
$ tox -e py27
$ tox -e pep8
.. _tox: https://tox.readthedocs.org/
.. _watcher: https://git.openstack.org/cgit/openstack/watcher
.. _Gerrit: https://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::
If you only want to run specific unit test code and don't like to waste time
waiting for all unit tests to execute, you can add parameters ``--`` followed
by a regex string::
$ workon watcher
(watcher) $ tox -e py27 -- -r watcher.tests.api
.. _os-testr: https://docs.openstack.org/os-testr/latest
When you're done, deactivate the virtualenv::
$ deactivate
$ tox -e py27 -- watcher.tests.api
.. _tempest_tests:
@ -55,4 +48,4 @@ 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
.. _watcher-tempest-plugin: https://git.openstack.org/cgit/openstack/watcher-tempest-plugin