microsoft / vscode-python

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

venv pytest discovery error when use parallel #21109

Closed HaujetZhao closed 1 year ago

HaujetZhao commented 1 year ago

Type: Bug

I'm reading the vscode document of python testing and following the instructions.

When I came to run-tests-in-parallel part, if I use venv, the discovery error will occur. But this error won't happen in normal environment.

Step to reproduce:

  1. create a venv python interpreter in the workdirectory
  2. choose the created venv
  3. pip install pytest pytest-xdist
  4. Command: Python: Configure Tests, choose pytest, select root directory
  5. create a file pytest.ini, paste these content:
[pytest]
addopts=-n4
  1. the Pytest Discovery Error occurs.

image

  1. switch the python interpreter to global interpreter, the error disappears.

image

VS Code version: Code 1.77.3 (704ed70d4fd1c6bd6342c436f1ede30d1cff4710, 2023-04-12T09:16:02.548Z) OS version: Windows_NT x64 10.0.19045 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 5 4600H with Radeon Graphics (12 x 2994)| |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: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|15.37GB (7.72GB free)| |Process Argv|--crash-reporter-id 082b1596-7408-4001-b8bf-dc4e9bc6a70e --crash-reporter-id 082b1596-7408-4001-b8bf-dc4e9bc6a70e --crash-reporter-id 082b1596-7408-4001-b8bf-dc4e9bc6a70e| |Screen Reader|no| |VM|0%|
Extensions (24) Extension|Author (truncated)|Version ---|---|--- language-gas-x86|bas|0.0.2 path-intellisense|chr|2.8.4 vsc-material-theme-icons|equ|2.7.5 exec-cmd|hat|0.0.2 plantuml|jeb|2.17.5 vscode-language-pack-zh-hans|MS-|1.77.2023040509 python|ms-|2023.7.11011538 vscode-pylance|ms-|2023.4.20 remote-containers|ms-|0.288.1 remote-ssh|ms-|0.100.0 remote-ssh-edit|ms-|0.84.0 remote-wsl|ms-|0.77.0 vscode-remote-extensionpack|ms-|0.24.0 cmake-tools|ms-|1.13.45 cpptools|ms-|1.14.5 powershell|ms-|2023.3.3 remote-explorer|ms-|0.4.0 remote-server|ms-|1.0.0 vscode-qt-for-python|sea|7.3.2 cmake|twx|0.0.17 intellicode-api-usage-examples|Vis|0.2.7 vscodeintellicode|Vis|1.2.30 vscodeintellicode-completions|Vis|1.0.21 markdown-all-in-one|yzh|3.5.1
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vslsvsres303:30308271 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 vscoreces:30445986 pythondataviewer:30285071 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 vsccc:30610678 nodejswelcome1:30587005 282f8724:30602487 pyind779:30671433 89544117:30613380 pythonsymbol12:30671437 2i9eh265:30646982 vsccsb:30705552 functionswalk:30687959 pythonms35:30701012 pythonfmttext:30710681 ```
eleanorjboyd commented 1 year ago

Hello! Could you provide the full logs from the python output channel? Also could you try just running "pytest" in your vscode integrated terminal and see if it works that way. Thanks!

brettcannon commented 1 year ago

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.