Repository navigation
Test Discovery fails with unittests #25448
Description
Type: Bug
Behaviour
Seemingly regardless of configurations, I get the error in the output panel regarding not being able to read properties of null.
This happens whenever I try to discover tests in my multi-root project. I'm guessing I get the error once for each root it fails to discover tests on?
Steps to reproduce:
- Attempt test discovery on a multi-root project?
I have tried changes in configuration, but they seem to have no effect, or give any different errors.
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2025-09-08 04:55:08.864 [info] > pyenv which python
2025-09-08 04:55:08.865 [info] cwd: y:\irenec\vscode
2025-09-08 04:55:12.270 [info] Active interpreter [y:\irenec\vscode]: c:\Python311\python.exe
2025-09-08 04:55:12.270 [info] Active interpreter [y:\irenec\dev\pipeline\src]: c:\Python311\python.exe
2025-09-08 04:55:12.271 [info] Active interpreter [y:\irenec\dev\pipelaunch\pipelaunch]: c:\Python311\python.exe
2025-09-08 04:55:12.272 [info] Discover tests for workspace name: vscode - root - uri: y:\irenec\vscode
2025-09-08 04:55:12.273 [info] Discover tests for workspace name: pipeline - uri: y:\irenec\dev\pipeline\src
2025-09-08 04:55:12.273 [info] Discover tests for workspace name: pipelaunch - uri: y:\irenec\dev\pipelaunch\pipelaunch
2025-09-08 04:55:13.018 [error] Test Discovery named pipe \.\pipe\python-test-discovery-c10f207410eb3ea75b73 error: TypeError: Cannot read properties of null (reading 'path')
at e (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:967372)
at t.PythonResultResolver._resolveDiscovery (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:951953)
at t.PythonResultResolver.resolveDiscovery (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:951037)
at c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:1001847
at _._callback (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:966565)
at b.callback (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:227145)
at Object.thunk (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:2032978)
2025-09-08 04:55:13.021 [error] Test Discovery named pipe \.\pipe\python-test-discovery-4d9602ac96f2e0990b34 error: TypeError: Cannot read properties of null (reading 'path')
at e (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:967372)
at t.PythonResultResolver._resolveDiscovery (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:951953)
at t.PythonResultResolver.resolveDiscovery (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:951037)
at c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:1001847
at _._callback (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:966565)
at b.callback (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:227145)
at Object.thunk (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:2032978)
2025-09-08 04:55:14.575 [info] Starting Pylance language server.
2025-09-08 04:55:18.882 [error] Test Discovery named pipe \.\pipe\python-test-discovery-a875b4296ff110b8e494 error: TypeError: Cannot read properties of null (reading 'path')
at e (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:967372)
at t.PythonResultResolver._resolveDiscovery (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:951953)
at t.PythonResultResolver.resolveDiscovery (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:951037)
at c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:1001847
at _._callback (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:966565)
at b.callback (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:227145)
at Object.thunk (c:\Users\irenec.vscode\extensions\ms-python.python-2025.12.0-win32-x64\out\client\extension.js:2:2032978)
Extension version: 2025.12.0
VS Code version: Code 1.103.2 (6f17636121051a53c88d3e605c491d22af2ba755, 2025-08-20T16:45:34.255Z)
OS version: Windows_NT x64 10.0.19045
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.11.9
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
- Value of the
python.languageServersetting: Default
User Settings
Multiroot scenario, following user settings may not apply:
languageServer: "Pylance"
testing
• unittestArgs: "<placeholder>"
• unittestEnabled: true
Installed Extensions
| Extension Name | Extension Id | Version |
|---|---|---|
| auto-comment-blocks | kev | 1.0.1 |
| autodocstring | njp | 0.6.1 |
| copilot | Git | 1.364.0 |
| copilot-chat | Git | 0.30.3 |
| debugpy | ms- | 2025.10.0 |
| extendscript-debug | Ado | 2.1.0 |
| gitlens | eam | 17.4.1 |
| js-debug | ms- | 1.102.0 |
| js-debug-companion | ms- | 1.1.3 |
| python | ms- | 2025.12.0 |
| vscode-js-profile-table | ms- | 1.0.10 |
| vscode-pull-request-github | Git | 0.116.2 |
| vscode-pylance | ms- | 2025.7.1 |
| vscode-python-envs | ms- | 1.2.0 |
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Xeon(R) W-2225 CPU @ 4.10GHz (8 x 4104) |
| GPU Status | 2d_canvas: enabled 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 vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 63.69GB (49.00GB free) |
| Process Argv | Y:\irenec\vscode\irenec_pipelaunch20.code-workspace --crash-reporter-id 0f3862e7-250e-488d-8961-f1c20f56d1d7 |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
aj953862:31281341
nesew2to5:31336538
agentclaude:31374413
nes-set-on:31340697
63221493:31336333
0927b901:31350571
aa_t:31379598
45650338:31358607
0cj2b977:31352657
gemagent1:31368469
cloudbuttont:31379625
retryenabled:31370050
3efgi100_wstrepl:31374188
trigger-command-fix:31379601
Activity
eleanorjboyd commentedon Sep 8, 2025
will investigate- thanks
slegt commentedon Sep 12, 2025
Test discovery fails, even in normal projects.
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
Output for Python Environment in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
This happens for various different selected python interpreters.
C:\Users\Simon Legtenborg\AppData\Local\Programs\Python\Python312\python.exe is a valid python path.
eleanorjboyd commentedon Sep 12, 2025
Hi! Has this worked before and is no longer working (like is this specifically a regression you are seeing)? Can you try running the following from your terminal and see if it works?
"C:\Users\Simon Legtenborg\AppData\Local\Programs\Python\Python312\python.exe" c:\Users\Simon Legtenborg\.vscode\extensions\ms-python.python-2025.14.0-win32-x64\python_files\unittestadapter\discovery.py --udiscovery -v -s . -p *test.pyyou may need to put quotations around the"*test.py". Just wondering if you get the error "UNITTEST ERROR: TEST_RUN_PIPE is not set at the time of unittest trying to send data. Pl...." like I do when I attempt itslegt commentedon Sep 12, 2025
It seems that the issue is caused by the newest VS code Windows version. After downgrading to the July build, everything works as expected.
Yes, im got the same result as you.
eleanorjboyd commentedon Sep 12, 2025
On the newest build can you try setting
python.useEnvironmentsExtensionin your user settings to false and see if that makes a difference? Also are you able to run a python file (like with the run button in the top corner) or does it also provide an error? Trying to narrow down which execution functionalities work and not as it is likely related to thatslegt commentedon Sep 15, 2025
This unfortunately doesn't do anything. However, i noticed that the command
is working fine for Windows Terminal, but not for PowerShell due to the Whitespace in the Path. To resolve this, one needs to use the call operator (&):
DiegoMont commentedon Sep 17, 2025
I am having the same problem. Previously it was working:
Output for
Pythonin theOutputpanel:Output for
Python Environmentsin theOutputpanel:Extension version: 2025.14.0
VS Code version: Version: 1.104.0 (Universal)
OS version: macOS Sequoia 15.6.1
I will be happy to share any additional details about my IDE settings :)
DiegoMont commentedon Sep 18, 2025
I downloaded the newest version of vscode (1.104.1) and the problem was gone 👍
irenepc commentedon Sep 19, 2025
I'm also no longer seeing the
TypeError: Cannot read properties of null (reading 'path')error on 1.104.1Tests are still not being discovered, but I'll tweak my settings to see if I can get them to be discovered now.
irenepc commentedon Sep 19, 2025
Hi Eleanor,
I tried this and got the same error as you. I'm now on version 1.104.1
Thank you for taking a look at the issue!
irenepc commentedon Sep 19, 2025
Ok! After getting the latest update (1.104.1), tweaking settings some more, and re-enabling the python environments extension I was able to get some tests to be discovered and testing.
Thanks everyone for all the clues/ideas!
fix quoting for runInBackground (#849)
fix quoting for runInBackground (#849)