aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-09-22 07:08:58 +0000
committerGerrit Code Review <review@openstack.org>2016-09-22 07:08:58 +0000
commit76ff764522e04a873be7443e579b7881e9ed32a2 (patch)
treec7e31b424d2c279cc4368a1c482e02dd73ddb453
parenteca14f64692f3628e78814a733c35b82b49b3878 (diff)
parent3bf571da06829e360f690ac565a4127be171ff67 (diff)
downloadkolla-76ff764522e04a873be7443e579b7881e9ed32a2.tar.gz
kolla-76ff764522e04a873be7443e579b7881e9ed32a2.zip
Merge "Add support to use pdb with tox"
-rw-r--r--doc/running-tests.rst20
-rw-r--r--tox.ini3
2 files changed, 22 insertions, 1 deletions
diff --git a/doc/running-tests.rst b/doc/running-tests.rst
index 473cbcc97..53e56dcbd 100644
--- a/doc/running-tests.rst
+++ b/doc/running-tests.rst
@@ -82,7 +82,25 @@ the ``kolla/tests/test_kolla_docker.py``` file:
$ tox -e py27 test_kolla_docker.ModuleArgsTest.test_module_args
+Debugging unit tests
+------------------------
+
+In order to break into the debugger from a unit test we need to insert
+a breaking point to the code:
+
+.. code-block:: python
+
+ import pdb; pdb.set_trace()
+
+Then run ``tox`` with the debug environment as one of the following::
+
+ tox -e debug
+ tox -e debug test_file_name.TestClass.test_name
+
+For more information see the `oslotest documentation
+<http://docs.openstack.org/developer/oslotest/features.html#debugging-with-oslo-debug-helper>`_.
+
.. rubric:: Footnotes
-.. [#f1] See http://docs.openstack.org/infra/system-config/jenkins.html
+.. [#f1] See http://docs.openstack.org/infra/system-config/jenkins.html \ No newline at end of file
diff --git a/tox.ini b/tox.ini
index b188089a0..6797a0fc4 100644
--- a/tox.ini
+++ b/tox.ini
@@ -18,6 +18,9 @@ commands =
find . -type d -name "__pycache__" -delete
python setup.py test --slowest --testr-args='{posargs}'
+[testenv:debug]
+commands = oslo_debug_helper {posargs}
+
[testenv:pep8]
commands =
{toxinidir}/tools/run-bashate.sh