Skip to content

Commit

Permalink
DOC: README.rst: note about pytest support
Browse files Browse the repository at this point in the history
  • Loading branch information
westurner authored and gotcha committed Aug 3, 2023
1 parent 65b3b7a commit 400e37c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,33 @@ instead of ``pdb``. (It does not depend on ``ipdb`` anymore).

.. _ipdbplugin: http://pypi.python.org/pypi/ipdbplugin
.. _nose: http://readthedocs.org/docs/nose


pytest
+++++++
pytest_ supports a ``--pdb`` option which can run ``ipdb`` /
``IPython.terminal.debugger:Pdb`` on ``Exception`` and ``breakpoint()``:

.. code:: bash
pytest --pdb --pdbcls=IPython.terminal.debugger:Pdb -v ./test_example.py
You don't need to specify ``--pdbcls`` for every ``pytest`` invocation
if you add ``addopts`` to ``pytest.ini`` or ``pyproject.toml``.

``pytest.ini``:

.. code:: bash
[tool.pytest.ini_options]
addopts = "--pdbcls=IPython.terminal.debugger:Pdb"
``pyproject.toml``:

.. code:: yml
[tool.pytest.ini_options]
addopts = "--pdbcls=IPython.terminal.debugger:Pdb"
.. _pytest: https://pypi.python.org/pypi/pytest

0 comments on commit 400e37c

Please sign in to comment.