Skip to content

A pytest plugin to help text editors launch a debugging session

License

Notifications You must be signed in to change notification settings

poppyschmo/pytest-pdb-break

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytest-pdb-break

OBSOLETE this project has been obsoleted by modern tooling with superior editor integration based on DAP. It will disappear from PyPI on or soon after January 1 2021. Maintenance will cease with the release of pytest 7.

Some possibilities worth trying:

This plugin merely launches PDB, the built-in GDB-style debugger. It does so by adding a command-line option to specify an initial breakpoint. [1] Included are add-ons for two traditional text editors, Vim and Emacs. They help fire up the debugger and fast-forward to the point of interest. If you already have a solid workflow with breakpoint() snippets and/or the --trace and --pdb options, there's nothing to see here.

This basically does ...

$ pytest --trace test_spam.py::test_foo
...
(pdb) until 42

with a few minor conveniences sprinkled in

Don't install

Unlike a proper pytest plugin, this isn't meant to be installed as a Python package. [2] The editor will instead inject an isolated installation via PYTHONPATH, but only while in use (no internet connection required).

TODOs

  1. Support remote operation
  2. Support arbitrary test names via the "python_functions" and python_classes options
  3. Ensure proper breaking in overridden fixtures
  4. Support FreeBSD (postponed/abandoned)
  5. Ditch helpers in favor of client/server model (postponed/abandoned)

Notes/caveats

  1. This is only meant to run under Linux but has been reported to work on MacOS
  2. It mainly exists for its author to learn about pytest, a decent understanding of which continues to evade
[1]E.g., pytest --break=test_file.py:42
[2]... unless used as a standalone command-line option