diff --git a/doc/source/contribute.rst b/doc/source/contribute.rst index 10fbd892..96dbb3e0 100644 --- a/doc/source/contribute.rst +++ b/doc/source/contribute.rst @@ -64,7 +64,7 @@ Several Linux distributions (notably Fedora 16 and Ubuntu 12.04) are also starti 7. Start coding -8. Run the test suite locally to make sure nothing broke, e.g. (this will run py26/py27/pep8 tests): +8. Run the test suite locally to make sure nothing broke, e.g. (this will run py34/py27/pep8 tests): .. code-block:: bash @@ -127,13 +127,41 @@ To run unit tests locally: $ pip install tox $ tox -To run py26, py27 or pep8 only: +To run py34, py27 or pep8 only: .. code-block:: console $ tox -e - #NOTE: is one of py26, py27 or pep8 + #NOTE: is one of py34, py27 or pep8 + +To run a single unit test e.g. test_deployment + +.. code-block:: console + + $ tox -e -- + + #NOTE: is one of py34, py27 or pep8 + # is the unit test case name + +To debug issues on the unit test: + +- Add breakpoints on the test file using ``import pdb;`` ``pdb.set_trace()`` +- Then run tox in debug mode: + +.. code-block:: console + + $ tox -e debug + #NOTE: use python 2.7 + #NOTE: is the unit test case name + + or + +.. code-block:: console + + $ tox -e debug34 + #NOTE: use python 3.4 + #NOTE: is the unit test case name To get test coverage: diff --git a/tox.ini b/tox.ini index a86bff56..b7d88c3a 100644 --- a/tox.ini +++ b/tox.ini @@ -35,10 +35,19 @@ basepython = python3.4 [testenv:venv] commands = {posargs} + +[testenv:debug] +commands = oslo_debug_helper -t tests {posargs} + +[testenv:debug34] +basepython = python3.4 +commands = oslo_debug_helper -t tests {posargs} + [testenv:cli] sitepackages = True commands = {toxinidir}/tests/ci/rally-integrated.sh + [testenv:cover] commands = {toxinidir}/tests/ci/cover.sh {posargs}