Repository navigation
re-running a pytest test causes it to run all tests in the workspace #338
Copy link
Copy link
Closed
microsoft/vscode-python
#24438Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked onverifiedVerification succeededVerification succeeded
Description
this started happening as of the latest vscode update (1.89.0)
to reproduce:
- put a breakpoint in a pytest test

- right click the run button and click "Debug test"
- when it pauses on the breakpoint, click the restart button

- check the debug console
Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 198, in _run_module_as_main return _run_code(code, main_globals, None, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 88, in _run_code exec(code, run_globals) File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module> cli.main() File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main run() File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file runpy.run_path(target, run_name="__main__") File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "c:\Users\user\.vscode\extensions\ms-python.python-2024.6.0\python_files\vscode_pytest\run_pytest_script.py", line 62, in <module> test_ids_from_buffer = raw_json["params"] ~~~~~~~~^^^^^^^^^^ KeyError: 'params'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onReady to be worked onverifiedVerification succeededVerification succeeded
Activity
brenoimatos commentedon May 7, 2024
Same thing happening here.
alfonzso commentedon May 15, 2024
Workaround (till not fixed): install/downgrade ms-python.python == 2024.4.1 version.
golgor commentedon May 17, 2024
Also started experiencing this. Thanks for the workaround Zsolt Alföldi (@alfonzso)!
iiwolf commentedon May 24, 2024
This was driving me nuts and I couldn't find a thread on it! Can confirm that downgrading works
eleanorjboyd commentedon Jun 3, 2024
Hello! We are aware of this issue and actively working to get a fix- apologies for the delay this ended up being a more complex fix than anticipated. Thanks
DetachHead commentedon Jul 23, 2024
it seems like a recent update has changed the behavior. now instead of raising
KeyError, it re-runs but it incorrectly attempts to run all tests in your project instead of the specific test you're trying to rerungolgor commentedon Jul 23, 2024
I can confirm this. It is very annoying. 😞
lanshenghai commentedon Aug 14, 2024
Not fixed until now?
1 remaining item
DetachHead commentedon Sep 19, 2024
Eleanor Boyd (@eleanorjboyd) it's still broken, it still attempts to re-run every test in the project instead of whatever test(s) were selected as i mentioned here. can this issue be re-opened please? (it doesn't let me re-open it myself)
or would you rather i raise a new issue as the behavior has changed?
paul-voelker commentedon Sep 20, 2024
Same for me
[-]`KeyError: 'params'` error when re-running pytest test[/-][+]re-running pytest test causes it to run all tests in the workspace[/+][-]re-running pytest test causes it to run all tests in the workspace[/-][+]re-running a pytest test causes it to run all tests in the workspace[/+]fix debug restart (microsoft#24438)
DetachHead commentedon Nov 21, 2024
works now, thanks!