Skip to content

Test discovery (pytest) fails in multi-root workspace: "payload UUID is not recognized" #21599

Closed
@mrburrito

Description

@mrburrito

Type: Bug

Behaviour

It looks like test discovery was updated in the most recent Python release and it now breaks for my multi-root, multi-venv project.

When I run discovery, I see a stream of log messages about running the pytest commands and then a lot of messages like:

2023-07-10 14:31:48.395 [info] Using result resolver for discovery
2023-07-10 14:31:48.395 [info] Using result resolver for discovery
2023-07-10 14:31:48.395 [info] Using result resolver for discovery
2023-07-10 14:31:48.438 [error] On data received: Error occurred because the payload UUID is not recognized
2023-07-10 14:31:48.438 [error] On data received: Error occurred because the payload UUID is not recognized
2023-07-10 14:31:48.438 [error] On data received: Error occurred because the payload UUID is not recognized
2023-07-10 14:31:48.680 [info] Test server connected to a client.
2023-07-10 14:31:48.686 [info] Test server connected to a client.
2023-07-10 14:31:48.686 [info] Test server connected to a client.

Once the refresh completes, I'll see only one, sometimes two or my test packages int he explorer and nothing else.

It looks to me like you may have changed how tests are discovered and handled by the new test server (experiment is enabled) and the discovery processes are not communicating back to the thread that's expecting them? Or maybe only the UUID from the last spawned process is tracked so that's the only one that gets discovered?

Expected vs. Actual

Expected: All of my tests to be discovered, displayed, and runnable from the test explorer.

Actual: Only tests from one module show up in test explorer.

Steps to reproduce:

  1. Create a multi-root workspace (mine has ~40 projects, 2 might be enough to trigger this?) where each project has it's own virtual environment in <project>/.venv and python.defaultInterpreterPath: "${workspaceFolder}/.venv/bin/python.
  2. Define pytest tests in each of the projects
  3. Open the Test Explorer view
  4. Refresh tests if they are not auto-discovered

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.16
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Default

Python output included in separate comment. Issue body too long.

Extension version: 2023.12.0
VS Code version: Code 1.80.0 (660393deaaa6d1996740ff4880f1bad43768c814, 2023-07-04T15:06:02.407Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Remote OS version: Linux x64 3.10.0-1160.88.1.el7.x86_64 (test discovery running on this remote)
Remote OS version: Linux x64 4.18.0-425.19.2.el8_7.x86_64

System Info
Item Value
CPUs AMD EPYC 7763 64-Core Processor (8 x 2445)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: unavailable_software
Load (avg) undefined
Memory (System) 31.95GB (12.54GB free)
Process Argv --crash-reporter-id 87e5818c-cbab-4d10-bc7f-19efe79b03de
Screen Reader yes
VM 0%
Item Value
Remote SSH: remote.host.com (test discovery running on this remote)
OS Linux x64 3.10.0-1160.88.1.el7.x86_64
CPUs Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz (4 x 2499)
Memory (System) 30.81GB (17.23GB free)
VM 0%
Item Value
Remote SSH: remote2.host.com
OS Linux x64 4.18.0-425.19.2.el8_7.x86_64
CPUs Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz (4 x 2500)
Memory (System) 30.75GB (18.92GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263:30335439
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30784847
vscaat:30438848
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
2e4cg342:30602488
pyind779:30671433
89544117:30613380
pythonsymbol12:30671437
showlangstatbar:30737416
vsctsb:30748421
pythonms35:30701012
03d35959:30757346
pythonfmttext:30731395
pythoncmv:30756943
fixshowwlkth:30771522
hideindicator:30785051
pythongtdpath:30769146
i26e3531:30780429
pythonnosm12tcf:30779713
pythonidxpt:30784022
pythonnocebcf:30776496
h7j2d465:30786200

Metadata

Metadata

Assignees

Labels

area-testinginfo-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions