-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Passing mock to open() crashes Test Run #22624
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
Comments
Will investigate- thanks for the detailed report! |
Hi! I tried this myself with the code you sent over and successfully got it to run. Could you try running it in the terminal with all these parameters |
Thank you for your effort. It looks like the problem doesn't hide within the vscode-extension and I am truly sorry for that. What I could confirm is that the usage of arguments I can execute a successful run when the append on the |
No need to apologies! Glad you got it figured out! Happy coding! |
Uh oh!
There was an error while loading. Please reload this page.
Type: Bug
Behaviour
Test execution fails the test while running Tests that passes MagicMock object to open() method.
First observed while testing fix for: #18030
Was using previously different Test Explorer (littlefoxteam.vscode-python-test-adapter), which had no issues with that test. However testing with previous vscode-python extensions down to "v2023.18.0" showed similar results (failures on that test).
Running the test directly via command line yields no errors (Test runs successfully).
Expected vs. Actual
Expected: Run, Debug Run, Run directly from console have the same output/result
Actual: Debugging and running directly from console end in successful result. Running from within test explorer crashes the test.
Steps to reproduce:
Run following Test via Test Explorer:
Run Fails:

Running pytest via command line directly works:
Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2023.23.13391009
VS Code version: Code 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:51:52.184Z)
OS version: Windows_NT x64 10.0.19045
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: