简体   繁体   中英

Cannot debug pytest tests in Visual Studio 2022 -- symbols not loaded for my python code

I'm trying to debug pytest tests in Visual Studio 2022. I have the tests showing up in test explorer and when I run them they execute, however when I set a breakpoint and try to debug the test the breakpoints show the warning symbol and when I hover over it, it informs me that the breakpoint will not be hit because symbols are not loaded. The test does actually run, I just can't figure out how to get it to load whatever it needs to in order for me to debug. It's python so there's no module to inspect in the modules window to tell it to load symbols for and nothing is compiled so I don't know where symbols would even be. Is there something that needs to be configured in the pyproject (besides setting the test framework to pytest)? Debugging in my other python projects just worked out of the box. Is there a setting for loading symbols for your own python code? If so, does anyone know where or why it would be disabled for pytest tests while testing?

It turns out this was a bug in VS. Simply updating to the latest version resulted in everything magically working as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM