Pycharm is not stopping on breakpoints in the unit tests - since PyCharm 2023.3.2 (Community Edition)
Since PyCharm 2023.3.2 (Community Edition) (Build #PC-233.13135.95, built on December 19, 2023) breakpoints are not working in the tests.
Runtime version: 17.0.9+7-b1087.9 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Station: Apple M2 Pro macOS Sonoma 14.2.1
I can debug and stop on break points in the code running from the main in the python files from anywhere, but it just doesn't stop in tests. Went through many similar issues from previous posts in Jetbrains tried everything but it just doesn't work. Tried to switch between “Module” to “Script path” in Run Configuration but no success.
Tried adding a new lines (print()) and set breakpoints on it, the code executed with the message printed in the console but pycharm doesn't stop on break points. Tried clean cache and restart and even we tried to do the same from another mac station. The problem persists.
Doesn't stop on exception (unless I set “On raise” on but it doesn't really useful)
I'm just getting tired of this for-no-reason memory heave and buggy IDE, time to move back to VSCode
Please sign in to leave a comment.
I'm sorry for the trouble being faced. Let's get additional details. Using a local interpreter with that Python version?
Please provide us with a valid example where this behavior can be reproducible.
I have the same issue on both desktop and notebook.
PyCharm 2023.3.3
Python v. 3.12.1
pytest 8.0.1
Similar for me,
It seems to stop on the breakpoint in its flow, but does not reflect that in UI – so the process seem like "hanging".
If I remove all breakpoints – it goes through – but very slowish…
Seems it happens for tests involving odoo models setup – non-odoo ORM tests seem to work smooth.
PS: Same with `PYDEVD_USE_CYTHON=NO`
or removeing cython extention as here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360010009979-Pycharm-2020-3-Debugger-is-not-working
Pycharm 2023.3.4 pro, pydev debugger (build 233.14475.56)
as well as 7.4.4 (with pytest-odoo plugin v 1.0.0)
============================= test session starts ==============================
platform linux -- Python 3.10.13, pytest-7.4.4, pluggy-1.4.0 -- /home/jurgis/dev/monodoo/venv_siramis/bin/python
cachedir: .pytest_cache
rootdir: /home/jurgis/dev/monodoo
configfile: pytest.ini
plugins: odoo-1.0.0
collecting ... collected 1 item
may be related https://youtrack.jetbrains.com/issue/PY-20186
I had the same symptoms, breakpoints are ignored when trying to debug a unit test (import unittest, run as module). I updated to 2024.1.1, and it worked, but only once. Can't get it to stop at breakpoints that I set via the UI.
PyCharm 2024.1.1 (Community Edition)
Build #PC-241.15989.155, built on April 29, 2024
Runtime version: 17.0.10+1-b1207.14 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.5.0
Registry:
ide.experimental.ui=true
Current Desktop: Budgie:GNOME
I found that selecting a different pyhon environment (usign conda) consistently resolves the problem, and shows it again when switching back.
Most significant changes seem to be, with the newer versions working:
Edit: Above versions don't matter, it even when I upgrade the packages in the conda env that doesn't stop at breakpoints, it still doesn't stop.
I've been having the same problem - it's exasperating.
-------------------------------
PyCharm 2023.2.5 (Community Edition)
Build #PC-232.10227.11, built on November 13, 2023
Runtime version: 17.0.9+7-b1000.46 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2020M
Cores: 8
Registry:
debugger.new.tool.window.layout=true
ide.experimental.ui=true
Updated to 2023.2.6 CE, no change.
Updated to 2024.1.2 CE, no change
Invalidated cache, no change
-------------------------------------
OS: Win 10 Pro, Build 10.0.19045, x65, Core i7-9700
Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32 (tried both, no difference)
Settings/Interpreter: Python 3.11 venv with pip 24.0, setuptools 70.0.0, wheel 0.43.0 and cbor2 5.6.3
Settings/Debugger/Stepping: Always do smart step into (checked), Do not step into (unchecked x2)
Python Debugger: tried with Gevent compatible unchecked and checked with no difference
The cbor2 package has the following code in module cbor2.tool:
with breakpoints on 206, 209 and 211. Debugging stops on 206, a step stops on 209 but a `step into` is ignored, stopping at 211 instead.
load is defined in cbor2._decoder.py:
as is CBORDecoder:
with breakpoints set on 95 and 210 (and elsewhere in the same file. Regardless of where breakpoints are set, CBORDecoder cannot be stepped into and breakpoints within it never stop execution, making it impossible to debug. In all cases, when stopped at line 211, “objs” is populated correctly, indicating that the decoder executed.
Presumably you can reproduce the same error by installing the cbor2 package and running the tool:
I have the same issue:
PyCharm 2024.1.4
Build #JBC-241.18034.82, built on June 24, 2024
Subscription is active until June 30, 2025.
Runtime version: 17.0.11+1-b1207.24 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
Controller in Remote Development
Python 3.11.9
Pytest 8.2.2
I have the same issue with “unittest” package:
Windows 11.0 Enterprise
Version 10.0.22631 Build 22631
---------latest version----------
PyCharm 2024.1.6 (Community Edition)
Build #PC-241.19072.16, built on August 8, 2024
Runtime version: 17.0.11+1-b1207.30 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
---------older version----------
PyCharm 2024.1.3 (Community Edition)
Build #PC-241.17890.14, built on June 4, 2024
Runtime version: 17.0.11+1-b1207.24 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
-----------------
Python 3.12.3 as Conda env
Running the code as “module” (instead of “script”)
And the problem already exists for some months. Can't remember, which version was first with this problems.
Thank you for highlighting details. Unfortunately, setting "Module" didn't do the trick and the issue is still unreproducible.
Could you please share a code sample for reproducing the issue and a requirements file for your Python environment?