Skip to content

re-running a pytest test causes it to run all tests in the workspace #338

Closed
microsoft/vscode-python
#24438
@DetachHead

Description

@DetachHead

this started happening as of the latest vscode update (1.89.0)

to reproduce:

  1. put a breakpoint in a pytest test
    image
  2. right click the run button and click "Debug test"
  3. when it pauses on the breakpoint, click the restart button
    image
  4. 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'
    

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugneeds PRReady to be worked onverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions