I cannot debug in PyCharm using py.test. All the test suite is running ok in "Debug mode" but it doesn't stop on breakpoints.
I also have py.test as the default test runner.
Maybe this is not important, but debugging works correctly in my Django server.
Any ideas?
picture of enable_breakpoints_and_the_mode_of_pycharm_is_debug
References:
pycharm-enabling-disabling-and-removing-breakpoints
Run/Debug Configuration: py.test
What fixed the problem for me is enabling the "Gevent compatible" checkbox the File → Settings → Build, Execution and Deployment → Python Debugger (not "Debugger"). Show activity on this post. I was using pyCharm 2018.1.
Just right-click any line in the editor and select the Debug <filename> command from the context menu. After the program has been suspended, use the debugger to get the information about the state of the program and how it changes during running.
For my situation, I found what the problem is:
If there is --cov
in pytest.ini
, then breakpoints in pycharm won't work, after deleting all --cov
in pytest.ini
, the breakpoints in pycharm can work.
Reason:
"The coverage module and pycharm's debugger use the same tracing api (sys.settrace) - they don't work together. " -- https://github.com/pytest-dev/pytest-cov/issues/131
References:
How to debug py.test in PyCharm when coverage is enabled
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With