microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.25k stars 1.15k forks source link

Discovered tests do no show up in the text explorer #23311

Closed stdavis closed 2 days ago

stdavis commented 2 months ago

Type: Bug

Behaviour

I am able to run tests via the command line (pytest) successfully, but the tests do not show up in the text explorer panel in VS Code. The python output seems to show that test discovery was successful.

Steps to reproduce:

  1. Clone https://github.com/agrc/python
  2. Create a new conda or venv environment and install the project dependencies (`pip install -e ".[tests]")
  3. Confirm that tests running successfully via the CLI (pytest)
  4. Run the "Tests: Refresh Tests" command
  5. Look for the test "test_hello_returns_hi" to show up in the test explorer panel

image

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

``` 2024-04-30 12:09:23.987 [info] Discover tests for workspace name: python - uri: /Users/.../Documents/Projects/python 2024-04-30 12:09:23.987 [info] Running discovery for pytest using the new test adapter. 2024-04-30 12:09:23.987 [info] All environment variables set for pytest discovery for workspace /Users/.../Documents/Projects/python: {"COMMAND_MODE":"unix2003","HOME":"/Users/...","LOGNAME":"...","LaunchInstanceID":"219B2F36-28BD-4BB7-ABFE-D437A8118A5F","MallocNanoZone":"0","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","SECURITYSESSIONID":"186a4","SHELL":"/bin/zsh","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.9KXT1t5Lbc/Listeners","TMPDIR":"/var/folders/sg/2h57mpl95yv6tqtwsvhzp0340000gn/T/","USER":"...","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"/Users/.../Library/Application Support/Code/CachedData/e170252f762678dec6ca2cc69aba1570769a5d39","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/.../Library/Application Support/Code/1.88-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en-us\",\"osLocale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"547","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.226327105.227828300","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","VSCODE_L10N_BUNDLE_LOCATION":"","PATH":"/usr/bin:/bin:/usr/sbin:/sbin","PYTHONPATH":"/Users/.../.vscode/extensions/ms-python.python-2024.4.1/python_files","TEST_UUID":"370e9a3f-72ce-4e2c-90ca-a59bbd042bef","TEST_PORT":"54455"} 2024-04-30 12:09:23.996 [info] > /usr/local/Caskroom/miniconda/base/bin/conda run -n python-project-template --no-capture-output python ~/.vscode/extensions/ms-python.python-2024.4.1/python_files/get_output_via_markers.py -m pytest -p vscode_pytest --collect-only tests 2024-04-30 12:09:23.996 [info] cwd: . 2024-04-30 12:09:29.263 [info] >>>PYTHON-EXEC-OUTPUT 2024-04-30 12:09:32.071 [info] ============================= test session starts ============================== platform darwin -- Python 3.11.9, pytest-8.2.0, pluggy-1.5.0 2024-04-30 12:09:32.149 [info] rootdir: /Users/.../Documents/Projects/python configfile: pyproject.toml plugins: cov-5.0.0, instafail-0.5.0, ruff-0.3.1, mock-3.14.0 2024-04-30 12:09:32.202 [info] collected 3 items 2024-04-30 12:09:32.202 [info]

2024-04-30 12:09:32.398 [info] Test server connected to a client. 2024-04-30 12:09:32.401 [info] ResultResolver EOT received for discovery. 2024-04-30 12:09:32.401 [info] ---------- coverage: platform darwin, python 3.11.9-final-0 ---------- Name Stmts Miss Branch BrPart Cover --------------------------------------------------------------- src/projectname/__init__.py 0 0 0 0 100% src/projectname/main.py 8 4 0 0 50% src/projectname/version.py 1 0 0 0 100% --------------------------------------------------------------- TOTAL 9 4 0 0 56% Coverage XML written to file cov.xml ========================== 3 tests collected in 0.33s ========================== <<

Extension version: 2024.4.1 VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:42:52.765Z) OS version: Darwin x64 23.4.0 Modes:

User Settings

``` languageServer: "Pylance" testing • pytestArgs: "" • pytestEnabled: true ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |.NET Install Tool|ms-dotnettools.vscode-dotnet-runtime|2.0.3| |Apex|salesforce.salesforcedx-vscode-apex|60.10.0| |Apex Interactive Debugger|salesforce.salesforcedx-vscode-apex-debugger|60.10.0| |Apex Replay Debugger|salesforce.salesforcedx-vscode-apex-replay-debugger|60.10.0| |ArcGIS JS API Module Butler|ScottDavis.vscode-arcgis-js-api-module-butler|1.0.2| |Ariake Dark|wart.ariake-dark|0.2.2| |Astro|astro-build.astro-vscode|2.8.6| |Atom Keymap|ms-vscode.atom-keybindings|3.3.0| |Atom One Dark Theme|akamud.vscode-theme-onedark|2.3.0| |Atom One Light Theme|akamud.vscode-theme-onelight|2.3.0| |Aura Components|salesforce.salesforcedx-vscode-lightning|60.10.0| |Auto Rename Tag|formulahendry.auto-rename-tag|0.1.10| |autoDocstring - Python Docstring Generator|njpwerner.autodocstring|0.6.1| |Ayu|teabyii.ayu|1.0.5| |Azure Repos|ms-vscode.azure-repos|0.38.0| |Bearded Theme|BeardedBear.beardedtheme|9.1.4| |Binary Plist|dnicolson.binary-plist|0.11.3| |Black Formatter|ms-python.black-formatter|2024.2.0| |Bluloco Light Theme|uloco.theme-bluloco-light|3.7.3| |C#|ms-dotnettools.csharp|2.23.15| |Cobalt2 Theme Official|wesbos.theme-cobalt2|2.4.3| |Code Spell Checker|streetsidesoftware.code-spell-checker|3.0.1| |codesong|connor4312.codesong|1.0.3| |Coding in the Sun!|Fasani.coding-in-the-sun|1.0.3| |Colonize|vmsynkov.colonize|2.2.2| |Color Highlight|naumovs.color-highlight|2.8.0| |Color Picker|anseki.vscode-color|0.4.5| |Copy Markdown as HTML|jerriepelser.copy-markdown-as-html|1.1.0| |Coverage Gutters|ryanluker.vscode-coverage-gutters|2.11.1| |Dev Containers|ms-vscode-remote.remote-containers|0.354.0| |Diff|fabiospampinato.vscode-diff|2.1.2| |Docker|ms-azuretools.vscode-docker|1.29.0| |DotENV|mikestead.dotenv|1.0.1| |Dracula Official|dracula-theme.theme-dracula|2.24.3| |EditorConfig for VS Code|EditorConfig.EditorConfig|0.16.4| |ESLint|dbaeumer.vscode-eslint|2.4.4| |Eva Theme|fisheva.eva-theme|2.6.0| |Even Better TOML|tamasfe.even-better-toml|0.19.2| |Excel Viewer|GrapeCity.gc-excelviewer|4.2.59| |Expo Tools|expo.vscode-expo-tools|1.5.0| |File Utils|sleistner.vscode-fileutils|3.10.3| |Git Project Manager|felipecaputo.git-project-manager|1.8.2| |GitHub Actions|github.vscode-github-actions|0.26.2| |GitHub Copilot|GitHub.copilot|1.184.0| |GitHub Copilot Chat|GitHub.copilot-chat|0.14.1| |Github Light Theme|Hyzeta.vscode-theme-github-light|7.14.2| |GitHub Markdown Preview|bierner.github-markdown-preview|0.3.0| |GitHub Plus Theme|thenikso.github-plus-theme|1.4.3| |GitHub Pull Requests|GitHub.vscode-pull-request-github|0.86.1| |GitHub Repositories|GitHub.remotehub|0.62.0| |GitHub Theme|GitHub.github-vscode-theme|6.3.4| |GitLens — Git supercharged|eamodio.gitlens|14.9.1| |Gruvbox Theme|jdinhlife.gruvbox|1.18.0| |HashiCorp Terraform|hashicorp.terraform|2.30.1| |Hopscotch|idleberg.hopscotch|0.8.2| |Horla Light Theme|Horla.horla-light-theme|0.0.3| |HTML to Markdown|YangtangWu.html-to-markdown|1.1.0| |IntelliCode|VisualStudioExptTeam.vscodeintellicode|1.3.1| |IntelliCode API Usage Examples|VisualStudioExptTeam.intellicode-api-usage-examples|0.2.8| |isort|ms-python.isort|2023.10.1| |JavaScript Debugger|ms-vscode.js-debug|1.88.0| |JavaScript Debugger Companion Extension|ms-vscode.js-debug-companion|1.1.2| |Jekyll Syntax Support|ginfuru.ginfuru-vscode-jekyll-syntax|0.1.1| |Jeng Theme Light|jeng.jeng-theme-light|1.0.5| |Jupyter|ms-toolsai.jupyter|2024.3.1| |Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|0.1.9| |Jupyter Keymap|ms-toolsai.jupyter-keymap|1.1.2| |Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|1.0.17| |Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|0.1.6| |Lightning Web Components|salesforce.salesforcedx-vscode-lwc|60.10.0| |Live Preview|ms-vscode.live-server|0.4.13| |Live Share|ms-vsliveshare.vsliveshare|1.0.5918| |Live Share Extension Pack|ms-vsliveshare.vsliveshare-pack|0.4.0| |LiveReload|ziishaned.livereload|0.2.5| |Luna Paint — Image Editor|Tyriar.luna-paint|0.16.0| |Lunar Theme|bereketsemagn.lunar|1.4.0| |Markdown Checkboxes|bierner.markdown-checkbox|0.4.0| |Markdown Emoji|bierner.markdown-emoji|0.3.0| |Markdown Footnotes|bierner.markdown-footnotes|0.1.1| |Markdown Preview Enhanced|shd101wyy.markdown-preview-enhanced|0.8.13| |Markdown Preview Github Styling|bierner.markdown-preview-github-styles|2.0.4| |Markdown Preview Mermaid Support|bierner.markdown-mermaid|1.22.0| |Markdown Table Formatter|fcrespo82.markdown-table-formatter|3.0.0| |Markdown yaml Preamble|bierner.markdown-yaml-preamble|0.1.0| |markdownlint|DavidAnson.vscode-markdownlint|0.55.0| |Material Icon Theme|PKief.material-icon-theme|5.1.0| |Material Theme|Equinusocio.vsc-material-theme|34.3.1| |MDX|unifiedjs.vscode-mdx|1.8.3| |Monokai Pro|monokai.theme-monokai-pro-vscode|1.3.2| |Night Owl|sdras.night-owl|2.0.1| |Noctis|liviuschera.noctis|10.43.3| |Nord|arcticicestudio.nord-visual-studio-code|0.19.0| |One Dark Pro|zhuangtongfa.material-theme|3.17.2| |Output Colorizer|IBM.output-colorizer|0.1.2| |Palenight Theme|whizkydee.material-palenight-theme|2.0.3| |Panda Theme|tinkertrain.theme-panda|1.3.0| |Peacock|johnpapa.vscode-peacock|4.2.2| |Playwright Test for VSCode|ms-playwright.playwright|1.0.22| |Poor Man's T-SQL Formatter|TaoKlerks.poor-mans-t-sql-formatter-vscode|1.6.10| |PostCSS Language Support|csstools.postcss|1.0.9| |PostgreSQL|ckolkman.vscode-postgres|1.4.3| |Prettier - Code formatter|esbenp.prettier-vscode|10.4.0| |Pylance|ms-python.vscode-pylance|2024.4.1| |Python|ms-python.python|2024.4.1| |Python Debugger|ms-python.debugpy|2024.4.0| |Python Environment Manager|donjayamanne.python-environment-manager|1.2.4| |Rainbow CSV|mechatroner.rainbow-csv|3.11.0| |Remote Repositories|ms-vscode.remote-repositories|0.40.0| |Ruff|charliermarsh.ruff|2024.20.0| |Salesforce CLI Integration|salesforce.salesforcedx-vscode-core|60.10.0| |Salesforce Extension Pack|salesforce.salesforcedx-vscode|60.10.0| |seti-icons|qinjia.seti-icons|0.1.3| |Shades of Purple|ahmadawais.shades-of-purple|7.3.2| |Simple React Snippets|burkeholland.simple-react-snippets|1.2.8| |SLDS Validator|salesforce.salesforce-vscode-slds|1.4.8| |Snazzy Light|loilo.snazzy-light|1.4.1| |SOQL|salesforce.salesforcedx-vscode-soql|60.10.0| |Sort JSON objects|richie5um2.vscode-sort-json|1.20.0| |Spanish - Code Spell Checker|streetsidesoftware.code-spell-checker-spanish|2.3.3| |SQL Formatter|adpyke.vscode-sql-formatter|1.4.4| |stylus|sysoev.language-stylus|1.16.0| |SunnyDay|stephanochsenfeld.sunnyday|0.0.3| |SynthWave '84|RobbOwen.synthwave-vscode|0.1.15| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.8| |TabOut|albert.TabOut|0.2.2| |Tailwind CSS IntelliSense|bradlc.vscode-tailwindcss|0.10.5| |Template String Converter|meganrogge.template-string-converter|0.6.1| |Theme +|ceciljacob.code-plus-theme|1.28.0| |Tokyo Night|enkia.tokyo-night|1.0.6| |Vim|vscodevim.vim|1.27.2| |Visualforce|salesforce.salesforcedx-vscode-visualforce|60.10.0| |Vitest|vitest.explorer|0.8.6| |vscode-icons|vscode-icons-team.vscode-icons|12.7.0| |vscode-json|andyyaldoo.vscode-json|1.5.2| |Winter is Coming Theme|johnpapa.winteriscoming|1.4.4| |Word Count|ms-vscode.wordcount|0.1.0| |WSL|ms-vscode-remote.remote-wsl|0.88.0| |XML Tools|DotJoshJohnson.xml|2.5.1| |XState VSCode|statelyai.stately-vscode|2.1.0| |YAML|redhat.vscode-yaml|1.14.0|
System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (16 x 2300)| |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_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|3, 3, 3| |Memory (System)|32.00GB (0.24GB free)| |Process Argv|--crash-reporter-id 5d451c32-6a35-4abc-ad2d-d1afb3207c80| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscorecescf:30445987 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 bf62j303:30959262 cppperfnew:31000557 fegfb526:30981948 bg6jg535:30979843 ccp2r6:30993542 dsvsc020:30976470 pythonait:31006305 gee8j676:31009558 showvideoc:31016891 chatpanelc:31018788 dsvsc021:30996838 945dj816:31013170 pythoncenvpt:31022790 ```
eleanorjboyd commented 2 months ago

Hi @stdavis, thanks for the detailed report will all that info- I was able to see the exact issue. What is happening is we currently don't support the plugin pytest-ruff which is generating most of those tests. I see the added support for this plugin would not be too hard but does require some engineering work so I am putting it on the backlog as a feature request to determine its prioritization.

github-actions[bot] commented 2 months ago

Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

brettcannon commented 2 days ago

Thank you for submitting your feature request and everyone who considered it! Unfortunately, this issue did not receive enough votes over the allotted time, and so we are closing the issue.