a1e8fc6dd9
* Explain these docs are for trunk (copied from ironic) * All the docs in this repo are meant to be developer docs, so having a devref inside of the docs is redundant and just makes the docs more complicated to navigate. Move everything out of the devref folder and link to everything from main index. * Move man pages into separate section. The man pages are pretty sparse * right now, we should either make them useful or just delete them * Remove dead docs from unused_docs list in doc/source/conf.py * Shuffle docs landing page, move common referees to the top (API, hypervisor support matrix), Add a introduction section and more. The hope is the updated layout makes this document easier to navigate. * Use maxdepth of 1 * Rename a few sections with what are hopefully better names The next step is to prune out outdated documents and further cleanup this page. Change-Id: Iff453e47ccc902a0e72b1a5f6ce1ee939ff3a1a0
64 lines
1.8 KiB
ReStructuredText
64 lines
1.8 KiB
ReStructuredText
Unit Tests
|
|
==========
|
|
|
|
Nova contains a suite of unit tests, in the nova/tests directory.
|
|
|
|
Any proposed code change will be automatically rejected by the OpenStack
|
|
Jenkins server [#f1]_ if the change causes unit test failures.
|
|
|
|
Preferred way to run the tests
|
|
------------------------------
|
|
|
|
The preferred way to run the unit tests is using ``tox``. See `the
|
|
unit testing section of the Testing wiki page`_ and `Nova's HACKING.rst`_
|
|
for more information. Following are some simple examples.
|
|
|
|
To run the style tests::
|
|
|
|
tox -e pep8
|
|
|
|
You can request multiple tests, separated by commas::
|
|
|
|
tox -e py27,pep8
|
|
|
|
.. _the unit testing section of the Testing wiki page: https://wiki.openstack.org/wiki/Testing#Unit_Tests
|
|
.. _Nova's HACKING.rst: http://git.openstack.org/cgit/openstack/nova/tree/HACKING.rst
|
|
|
|
Running a subset of tests
|
|
-------------------------
|
|
|
|
Instead of running all tests, you can specify an individual directory, file,
|
|
class, or method that contains test code.
|
|
|
|
To run the tests in the ``nova/tests/unit/scheduler`` directory::
|
|
|
|
tox -e py27 nova.tests.unit.scheduler
|
|
|
|
To run the tests in the ``nova/tests/unit/virt/libvirt/test_driver.py`` file::
|
|
|
|
tox -e py27 test_driver
|
|
|
|
To run the tests in the ``CacheConcurrencyTestCase`` class in
|
|
``nova/tests/unit/virt/libvirt/test_driver.py``::
|
|
|
|
tox -e py27 test_driver.CacheConcurrencyTestCase
|
|
|
|
To run the `ValidateIntegerTestCase.test_invalid_inputs` test method in
|
|
``nova/tests/unit/test_utils.py``::
|
|
|
|
tox -epy27 test_utils.ValidateIntegerTestCase.test_invalid_inputs
|
|
|
|
Debugging strange test failures
|
|
-------------------------------
|
|
|
|
Things to try when there are odd test failures such as failure on
|
|
jenkins but not locally.
|
|
|
|
The venv can get stale. Force a refresh by adding the -r flag::
|
|
|
|
tox -r -e pep8
|
|
|
|
.. rubric:: Footnotes
|
|
|
|
.. [#f1] See :doc:`jenkins`.
|