-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Stderr output causes test discovery to show as failed #18547
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
Hi @Cnoor0171, thank you for reaching out. As you experienced, right now we read test output from stdout/stderr, and this is very brittle. We are updating this mechanism as part of #6594 and #17242. Secondly, the |
still exists on rewrite- will need another PR to fix. |
tried this on the rewrite on insiders and it no longer shows the test as failed on discovery. I was also able to run the test as follows and it works passes.
please comment if I tested it incorrectly or if you are still seeing the issue. |
Issue Type: Bug
Behaviour
Expected vs. Actual
This is duplicate of #7095, but that issue was closed because the author didn't provide steps to reproduce. The bug is still there.
Expected: the extension to be able to detect tests when pytest test discovery succeeds, even if there is output on stderr.
Actual: If there is leftover output on stderr, the extension fails to discover tests. Note that the print needs to happen during test discovery, NOT inside the test. Also note that the discovery only fails if content is written to stderr or stdout after pytest thinks it's done reporting the test collection results. For that to happen we need to spin up a separate thread that waits to print something. In my particular case, the culprit was a library that spawns a background thread for log processing that was logging a warning. Running
pytest --collect-only
exits cleanly, but the extension is not able to process the results.The extension logs show:
Steps to reproduce:
pytest
in a venvtest_something.py
with contentDiagnostic data
python.languageServer
setting: PylanceUser Settings
Extension version: 2022.0.1814523869
VS Code version: Code 1.64.2 (f80445acd5a3dadef24aa209168452a3d97cc326, 2022-02-09T22:02:28.252Z)
OS version: Windows_NT x64 10.0.19044
Restricted Mode: No
Remote OS version: Linux x64 5.10.16.3-microsoft-standard-WSL2
Remote OS version: Linux x64 5.10.16.3-microsoft-standard-WSL2
System Info
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: