Skip to content

Unittest test discovery fails for Python 3.15 #25802

@pewscorner

Description

@pewscorner

Type: Bug

Behaviour

The testing panel fails to list more than one unittest test when using the latest Python 3.15.0 prerelease (a6).

Steps to reproduce:

  1. Open a folder containing unittest tests.
  2. Set the Python interpreter to Python 3.15.0a6.
  3. Check the list of tests in the testing panel. This list will be incomplete (only the first test will be visible), and the Python output log will show an error (see below).

Note that test discovery works just fine outside VS Code, e.g. using the following command:

py -3.15 -m unittest discover -v -s . -p "*unittest.py"

Example of failed test discovery with Python 3.15.0a6

Image

Example of successful test discovery with Python 3.14.3

Image

Diagnostic data

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

2026-02-18 01:27:44.521 [info] Environment variables set for unittest discovery: TEST_RUN_PIPE=\\.\pipe\python-test-discovery-5f89198e3aad4f29231c
2026-02-18 01:27:44.521 [info] Using execution factory for unittest discovery in workspace c:\Users\user\Documents\PythonProjects\PythonQuickRefTest
2026-02-18 01:27:44.530 [info] > "C:\Program Files\Python315\python.exe" ~\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\python_files\unittestadapter\discovery.py --udiscovery -v -s ./unittests -p *unittest.py
2026-02-18 01:27:44.530 [info] cwd: .
2026-02-18 01:27:44.530 [info] Started unittest discovery subprocess (execution factory) for workspace c:\Users\user\Documents\PythonProjects\PythonQuickRefTest
2026-02-18 01:27:44.696 [error] Test Discovery named pipe \\.\pipe\python-test-discovery-5f89198e3aad4f29231c error: [TypeError: Cannot read properties of undefined (reading 'forEach')
	at e (c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:993915)
	at c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:994918
	at Array.forEach (<anonymous>)
	at e (c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:993915)
	at c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:994918
	at Array.forEach (<anonymous>)
	at e (c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:993915)
	at c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:994918
	at Array.forEach (<anonymous>)
	at e (c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:993915)
	at t.TestDiscoveryHandler.processDiscovery (c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:970224)
	at u.resolveDiscovery (c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:967007)
	at c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:960124
	at _._callback (c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:992938)
	at b.callback (c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:227303)
	at Object.thunk (c:\Users\user\.vscode\extensions\ms-python.python-2026.2.0-win32-x64\out\client\extension.js:2:2069243)]
2026-02-18 01:27:44.708 [info] Unittest discovery completed for workspace c:\Users\user\Documents\PythonProjects\PythonQuickRefTest

Extension version: 2026.2.0
VS Code version: Code 1.109.4 (c3a26841a84f20dfe0850d0a5a9bd01da4f003ea, 2026-02-16T15:35:57.932Z)
OS version: Windows_NT x64 10.0.26200
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i9-14900K (32 x 3187)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x10de, DEVICE=0x2803 [NVIDIA GeForce RTX 4060 Ti], DRIVER_VENDOR=NVIDIA, DRIVER_VERSION=32.0.15.8104 ACTIVE
GPU1: VENDOR= 0x8086, DEVICE=0xa780 [Intel(R) UHD Graphics 770], DRIVER_VERSION=32.0.101.7077
GPU2: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.7309
Machine model name:
Machine model version:
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
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 61.66GB (45.27GB free)
Process Argv
Screen Reader no
VM 0%

Metadata

Metadata

Assignees

Labels

triage-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