Open Aran-Fey opened 4 weeks ago
This may only be an issue if PatchMode.AUTO
is used, now that I think about it.
Yeah, PatchMode.AUTO
may have unwanted side effects and probably won't play nice with a debugger, as that relies on loading code on a low level.
If this indeed only happens if patching open_code
, there is probably not much we can do with reasonable effort. I don't think I want to go down that rabbit hole...
@Aran-Fey - can you confirm that this only happens with PatchMode.AUTO
?
Actually, nope. A duplicate tab is opened regardless of the PatchMode
, and the breakpoints continue to sometimes be ignored without any apparent reason.
Ok, thanks. I'm not using VSCode (I use PyCharm), so it may take a while to understand this. Do you have a way to reproduce this with some minimal example?
This seems to do it:
import typing
def test_demo(fs):
typing.get_type_hints(int)
typing.get_type_hints(int)
-> breakpoint is hit, duplicate file tab is openedget_type_hints
-> breakpoint is ignoredfs
fixture: Both issues go awayThanks, I will give it a try!
You are working with the current pyfakefs version (5.7.1), right?
Ah, and which Python version are you using?
Correction: Only the duplicate tab issue goes away. Having some trouble reproducing the breakpoint issue. If I replace typing
with a custom-made python module, the breakpoint is hit as expected. Maybe breakpoints don't work in the stdlib or something, or maybe it's just the bug being janky again. Really not sure.
I'm using pyfakefs 5.7.1 and cpython 3.10.13.
So far, I have not been able to get sensible behavior even in tests without pyfakefs - I guess I have to better understand the workflow in VSCode first... Will have another go over the weekend.
Ok, I persuaded VSCode to work for me, and I can reproduce the duplicate tab behavior now (not the ignored breakpoint so far). At the moment, I have no idea where to even look, so no promises...
Using pyfakefs leads to a variety of issues with vscode's debugger, like breakpoints not working and duplicate file tabs being opened. I made a bug report here, but the folks at debugpy have decided it's not their responsibility to fix it. Can you guys take care of it?