Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DetachHead opened this issue May 7, 2024 · 11 comments
Open
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team

Comments

@DetachHead
Copy link

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'
    
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label May 7, 2024
@brenoimatos
Copy link

Same thing happening here.

@alfonzso
Copy link

Workaround (till not fixed): install/downgrade ms-python.python == 2024.4.1 version.

@golgor
Copy link

golgor commented May 17, 2024

Also started experiencing this. Thanks for the workaround @alfonzso!

@iiwolf
Copy link

iiwolf commented May 24, 2024

This was driving me nuts and I couldn't find a thread on it! Can confirm that downgrading works

@paulacamargo25 paulacamargo25 added bug Issue identified by VS Code Team member as probable bug and removed triage-needed Needs assignment to the proper sub-team labels May 31, 2024
@eleanorjboyd
Copy link
Member

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
Copy link
Author

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 rerun

@golgor
Copy link

golgor commented 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 rerun

I can confirm this. It is very annoying. 😞

@lanshenghai
Copy link

Not fixed until now?

@eleanorjboyd
Copy link
Member

Hello! I am pretty sure we fixed this but please reopen if that is not the case- thanks!

@DetachHead
Copy link
Author

DetachHead commented Sep 19, 2024

@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
Copy link

@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?

Same for me

@karthiknadig karthiknadig reopened this Sep 20, 2024
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 20, 2024
@DetachHead DetachHead changed the title KeyError: 'params' error when re-running pytest test re-running pytest test causes it to run all tests in the workspace Sep 20, 2024
@DetachHead DetachHead changed the title 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 Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

10 participants