You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem to recognize tests with @pytest.mark.parametrize decorator inside class #947
So, The problem is that the run/debug button from vscode doesn't appear when the test is decorated with @pytest.mark.parametrize.
According with the picture I attached, the first test, which is decorated, doesn't have the run/debug enabled. While the second test without the decorator has the run/debug button enabled.
But if you look in the Testing panel, that test has to be listed there to be debuggable.
This failure wouldn't be with the debug extension though. It should be with the Python base extension as it does the test analysis. The debugger extension doesn't even know about pytest tests.
I believe that code is in the test discovery in the vscode-python extension.
Rich Chiodo (@rchiodo) Even though your method has the 'self' as argument, it doesn't look like to be a method class because it doesn't have identantion enough. Are you sure you tested it as a method class?
Why I can not reopen this issue?! The answer from Rich Chiodo (@rchiodo) is not clear enough for me.
The likely root cause (in my opinion) is the test discovery that the vscode-python extension is doing. You can look at logs for that somewhere in the Output terminal and see what tests it discovers.
Whatever tests it discovers should show up in the Test panel:
I know pytest can be finicky though. You can't have any problems in the code that might cause a runtime problem. That will prevent it from identifying tests.
Activity
rchiodo commentedon Feb 5, 2026
Works for me. Not sure what the difference is.
But if you look in the
Testingpanel, that test has to be listed there to be debuggable.This failure wouldn't be with the debug extension though. It should be with the Python base extension as it does the test analysis. The debugger extension doesn't even know about pytest tests.
I believe that code is in the test discovery in the vscode-python extension.
roschel commentedon Feb 5, 2026
Rich Chiodo (@rchiodo) Even though your method has the 'self' as argument, it doesn't look like to be a method class because it doesn't have identantion enough. Are you sure you tested it as a method class?
Why I can not reopen this issue?! The answer from Rich Chiodo (@rchiodo) is not clear enough for me.
rchiodo commentedon Feb 5, 2026
I didn't try as a method class, but that works for me too.
The bug here is not in the vscode-python-debugger extension though. It doesn't provide these debug buttons. The vscode-python extension does.
rchiodo commentedon Feb 5, 2026
The likely root cause (in my opinion) is the test discovery that the vscode-python extension is doing. You can look at logs for that somewhere in the Output terminal and see what tests it discovers.
Whatever tests it discovers should show up in the Test panel:
I know pytest can be finicky though. You can't have any problems in the code that might cause a runtime problem. That will prevent it from identifying tests.
roschel commentedon Feb 5, 2026
Rich Chiodo (@rchiodo) thank you so much, this was a very useful answer!
I will look around the problem in the vscode-python repository.
Thank you!