Relative Paths When Debugging In Tests

There seem to be similar topics, but either old or unanswered or about remote debugging. My situations:

PyCharm 2019.3. When running tests, the editor shows a normal, relative to the project file path, but when I'm running in debug, it switches to an absolute path.

>> Running tests, file path: my_proj/tests/foo_test.py

>> Debugging tests: file path: /net/mount/users/.../my_proj/tests/foo_test.py

Can it somehow be fixed?

 

Thank you,

Alex

3

What kind of test is it?
Where do you see those paths? Please share a screenshot.

0

Hi Sergey,

At the top is my tests module, as I mentioned, when I just run my app with a regular Run configuration it just works. However as soon I set a breakpoint in one of my tests, the editor switches to show the absolute path of the file. The debugging works as expected though, but it's very inconvenient because for PyCharm these two files paths despite being the same file, are two different files(sort of). I have to switch (Shift+Tab) to the original(relative path) file for editing. If I change the file when it's in "absolute mode", the changes won't be reflected in "relative mode" until PyCharm syncronizes ( for example when window focus changes). 

My suspicion is that due to network paths, PyCharm debugger thinks that the files are different.

I would appreciate any help.

 

Alex.

 

0

I'm having the same problem, but on Windows.  In my case the symptoms are identical except that the network drive path that the project is loaded from (i.e. S:\Projects) gets replaced with the UNC path (i.e. \\fileserver\shares\Projects).  Otherwise the issues are the same.

Also, this only happens for me with Python 3.8.  Python 3.6 and 3.7 do not exhibit this behavior.  However, I still have this issue even going back to older versions of PyCharm.  I tested 2019.2.6 and 2019.1.4 which both had the same problem when using Python 3.8.

0

Dear developer, can you confirm if it's a bug or not?  It happens to me all the time, not only with tests but with any script that I run in the debugger.

0

请先登录再写评论。