Repository navigation
Having PYTHONWARNINGS=default crashes pytest discovery #20259
Copy link
Copy link
Closed
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Description
Type: Bug
Behaviour
Expected vs. Actual
When opening vscode with PYTHONWARNINGS=default and a warning is given it will fail discovering and error out. I would assume it could handle the warning.
Steps to reproduce:
- Set
export PYTHONWARNINGS=default - Open code from terminal with
code . - Have a module with a warning in it (for me it is playwright-pytest).
- I have used the following environment:
mamba create -n tmp python=3.10 pytest
mamba install playwright -c microsoft -y
pip install pytest-playwrightDiagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.7
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
- Value of the
python.languageServersetting: Pylance
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
> conda run -n tmp --no-capture-output python ~/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/printEnvVariables.py
> conda run -n tmp --no-capture-output python ~/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.18.2/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear .
cwd: .
[ERROR 2022-10-21 21:58:29.261]: Error discovering pytest tests:
[n [Error]: <frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
/home/shh/miniconda3/envs/tmp/lib/python3.10/tempfile.py:860: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/playwright-pytest-bus6_mv3'>
_warnings.warn(warn_message, ResourceWarning)
at ChildProcess.<anonymous> (/home/shh/.vscode/extensions/ms-python.python-2022.18.2/out/client/extension.js:2:242843)
at Object.onceWrapper (node:events:646:26)
at ChildProcess.emit (node:events:526:28)
at maybeClose (node:internal/child_process:1092:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5)]
User Settings
languageServer: "Pylance"
linting
• flake8Args: "<placeholder>"
• flake8Enabled: true
• mypyArgs: "<placeholder>"
• mypyEnabled: true
formatting
• provider: "black"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
Extension version: 2022.18.2
VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T03:54:53.913Z)
OS version: Linux x64 6.0.6-76060006-generic
Modes:
Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 9 5900X 12-Core Processor (24 x 4171) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off 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 skia_renderer: enabled_on video_decode: disabled_software video_encode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | 1, 1, 1 |
| Memory (System) | 125.72GB (116.09GB free) |
| Process Argv | /home/shh/bin |
| Screen Reader | no |
| VM | 0% |
| DESKTOP_SESSION | pop |
| XDG_CURRENT_DESKTOP | Unity |
| XDG_SESSION_DESKTOP | pop |
| XDG_SESSION_TYPE | x11 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Activity
brettcannon commentedon Nov 22, 2022
This is due to us parsing the output from pytest at the moment. We are working on rewriting our pytest support so that our integration is via a pytest plug-in, but that work is still ongoing.
eleanorjboyd commentedon Jul 7, 2023
Hello! We have just finished our testing rewrite and are beginning the roll out to users. I have tested this issue with the re-write and I am no longer reproducing the bug! If you would like to try it yourself, you need to add this setting to your users
settings.json"python.experiments.optInto": ["pythonTestAdapter"]. Let me know if it doesn’t work for you and we can re-open this issue. Thanks!hoxbro commentedon Jul 18, 2023
I'm still seeing problems with the new test adapter. I think it can't handle skipping tests:
Emitted here: https://github.com/holoviz/holoviews/blob/003be4133a13949bf9bf081729e8fd2014cb511b/holoviews/tests/core/data/test_cudfinterface.py#L10
Do you want me to open a new issue?
brettcannon commentedon Jul 18, 2023
Simon Høxbro Hansen (@hoxbro) Yes please! Instructions can be found at https://aka.ms/pvsc-bug .