microsoft/debugpy

Hitting a breakpoint opens a new instance of the file

alexandre-perrin opened this issue · 2 comments

I am hitting an issue occurring at the moment on only one file in my project.
When I launch a debug session with a break point on this specific file, the debugger opens a new tab each time the debugger breaks.

Environment data

VS Code version: 1.95.3
Extension version (available under the Extensions sidebar): v2024.12.0
OS and version: Kubuntu 22.04
Python version (& distribution if applicable, e.g. Anaconda): Python 3.10.12
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv or none, same issue

Test with pytest and pyfakefs

Expected behaviour

When hitting a breakpoint during debug, the corresponding line in the already opened source file should be highlighted

Actual behaviour

A new tab is opened with the file with breakpoint, then opens a new tab for each debug step.

One more thing I just noticed, this occurs only with usage of pyfakefs pytest plugin...

It could be related that the file system gets mocked and alters the behaviour of the debugger.

Yes pyfakefs would cause the debugger to think the actual file doesn't exist because pyfakefs is rewiring the file system.

See these issues for more information:
#1709
#267