Starting a couple days ago my normal process for debugging python code via pytest has just stopped working. My previous process was as follows: Insert the debugpy macro either above the pytest test definition or at the top level of the code being debugged. import debugpy debugpy.listen(5678) debugpy.wait_for_client() Insert the debugpy.breakpoint() call above the line to stop at OR use the red gutter button to mark a breakpoint (less reliable). Hit the F5 key when pytest started and the collecting... message appeared in the terminal. This process worked for the entire two months since I converted from PyCharm. As of a couple days ago, the new behavior is as follows: If I use the debugpy.breakpoint() call to stop the run, the code will stop however in a seemingly random place. Before I reinstalled nearly everything (VSCode, created a new linux VM), it would stop at a random line inside a file from the pytest library. After I reinstalled everything, it now stops a random line inside our test database teardown code. If I use the red gutter button to mark a breakpoint, the debugger will not stop at all. Things I've already tried: Clean reinstall of VSCode. Destroy and recreate vagrant VM. Add "env": {"PYTEST_ADDOPTS": "--no-cov"} to my launch.json. (The linter warns that this property is not allowed here and the option is not added at runtime). Downgraded the Python extension. Toggled the justMyCode launch option. Tried multiple git branches. Tried multiple modules in our monorepo. Again, I'd like to emphasize that this did work previously and that I made no configuration changes to cause this. More info: Version: 1.74.2 (Universal) Commit: e8a3071ea4344d9d48ef8a4df2c097372b0c5161 Date: 2022-12-20T10:26:09.430Z (3 wks ago) Electron: 19.1.8 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin x64 21.6.0 Sandboxed: No launch.json "version": "0.2.0", "configurations": [ { "name": "Python: Remote Attach", "type": "python", "request": "attach", "connect": { "host": "localhost", "port": 5678 }, "pathMappings": [ { "localRoot": "/mnt/the_repo_folder", "remoteRoot": "/mnt/the_repo_folder" } ], "justMyCode": true } ] } Continue reading...