ipdb as my default debugger, I used to set:
~/.bash_profile (following this advice).
However, this doesn’t play nicely with pytest’s output capturing.
Pytest has a useful feature where it disables output capturing if
is called during test
which allows access to the debugger prompt. However, this only works if
PYTHONBREAKPOINT is unset. If you have
PYTHONBREAKPOINT set to a non-empty
value, then you need to use pytest’s
option to disable all output capturing. But this isn’t generally desirable as it
can lead to lots of unnecessary output being printed to your terminal during
--pdbcls=IPython.terminal.debugger:Pdb doesn’t make any difference
PYTHONBREAKPOINT is set.
A decent work-around is to not set
PYTHONBREAKPOINT globally and install
pdb++ which provides much of the benefit of
ipdb (e.g. syntax highlighting, tab completion) but doesn’t suffer from the
above problem; you can access the debugger without using the
For projects that use
ipdb, you can set
PYTHONBREAKPOINT on a per-project