pytest-pycharm

raw JSON →
0.7.0 verified Fri May 01 auth: no python maintenance

Plugin for pytest to drop into PyCharm debugger on uncaught exceptions. Version 0.7.0 is the latest, with no recent updates. The plugin is in maintenance mode.

pip install pytest-pycharm
error ModuleNotFoundError: No module named 'pytest_pycharm'
cause Missing installation or incorrect import path.
fix
pip install pytest-pycharm. The plugin registers itself as a pytest plugin; no import needed.
error Error: unrecognized arguments: --pycharm
cause Plugin not installed or not activated.
fix
Ensure pytest-pycharm is installed (pip list | grep pytest-pycharm) and run pytest with the --pycharm flag.
gotcha The plugin only works with PyCharm debug server; you must have PyCharm running with a Python Debug Server configured.
fix Set up PyCharm's Remote Debug configuration (Run > Edit Configurations > Python Debug Server) and note the port.
gotcha The plugin does not automatically connect; you must manually start the PyCharm debug server before running tests.
fix In PyCharm, run the 'Python Debug Server' configuration before executing pytest.

Install and run pytest with --pycharm flag to enable PyCharm debugger on uncaught exceptions. Ensure PyCharm debug server is listening.

import sys
import os
os.environ.setdefault('PYCHARM_DEBUG_PORT', '12345')
# Run pytest with --pycharm
# ptest --pycharm tests/