Skip to content

The new pythonTestAdapter does not find python executable #24572

@michaelschwier

Description

@michaelschwier

Type: Bug

Behaviour

I cannot run unittests with the new pythonTestAdapter. During test discovery I get the error that "Python" could not be found and hence the test process exits.

But:

  • Running the unit test code directly in the integrated debugger works fine.
  • If I add "python.experiments.optOutFrom": ["pythonTestAdapter"] to settings.json, integrated testing works fine.

Steps to reproduce:

  1. Create a conda python environment with minforge.
  2. Choose python from that env as your interpreter via STRG+Shift+P "Python: Select Interpreter"
  3. Enable Unit Test in settings.json
    "python.testing.unittestEnabled": true,
    "python.testing.pytestEnabled": false,
    "python.testing.unittestArgs": [
        "-v",
        "-p",
        "*_test.py"
    ]
  1. Open the integrated Testing and watch how the discovery fails.

Diagnostic data

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

2024-12-10 15:51:25.754 [info] Discover tests for workspace name: python - uri: d:\Dev\Repos\myproject\python
2024-12-10 15:51:25.754 [info] Running discovery for unittest using the new test adapter.
2024-12-10 15:51:25.766 [info] > D:\miniforge3\Scripts\conda.exe run -n MyCondaEnv --no-capture-output python ~\.vscode\extensions\ms-python.python-2024.14.1-win32-x64\python_files\get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.14.1-win32-x64/python_files/printEnvVariables.py
2024-12-10 15:51:25.766 [info] shell: commandPrompt
2024-12-10 15:51:26.671 [info] > pixi --version
2024-12-10 15:51:26.672 [warning] could not find a pixi interpreter for the interpreter at D:\miniforge3\envs\MyCondaEnv\python.exe
2024-12-10 15:51:26.718 [info] Discovering unittest tests for workspace d:\Dev\Repos\myproject\python with arguments: c:\Users\z003wy1p\.vscode\extensions\ms-python.python-2024.14.1-win32-x64\python_files\unittestadapter\discovery.py,--udiscovery,-v,-p,*_test.py

2024-12-10 15:51:26.718 [info] > python ~\.vscode\extensions\ms-python.python-2024.14.1-win32-x64\python_files\unittestadapter\discovery.py --udiscovery -v -p *_test.py
2024-12-10 15:51:26.718 [info] cwd: .
2024-12-10 15:51:26.807 [error] Python konnte nicht gefunden werden. F�hren Sie die Verkn�pfung ohne Argumente aus, um sie �ber den Microsoft Store zu installieren, oder deaktivieren Sie diese Verkn�pfung unter 
2024-12-10 15:51:26.813 [error] Subprocess exited unsuccessfully with exit code 9009 and signal null on workspace d:\Dev\Repos\myproject\python. Creating and sending error discovery payload 

2024-12-10 15:51:26.813 [error] Subprocess exited unsuccessfully with exit code 9009 and signal null on workspace d:\Dev\Repos\myproject\python. Creating and sending error discovery payload
2024-12-10 15:51:26.813 [error] Unittest test discovery error for workspace:  d:\Dev\Repos\myproject\python 
  
 The python test process was terminated before it could exit on its own, the process errored with: Code: 9009, Signal: null for workspace d:\Dev\Repos\myproject\python

Extension version: 2024.14.1
VS Code version: Code 1.92.2 (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z)
OS version: Windows_NT x64 10.0.19045
Modes:

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


envFile: "<placeholder>"

languageServer: "Pylance"

testing
• unittestArgs: "<placeholder>"
• unittestEnabled: true

Installed Extensions
Extension Name Extension Id Version
GitHub Copilot GitHub.copilot 1.249.0
GitHub Copilot Chat GitHub.copilot-chat 0.18.2
JavaScript Debugger ms-vscode.js-debug 1.92.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
Jupyter ms-toolsai.jupyter 2024.7.0
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.19
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Pylance ms-python.vscode-pylance 2024.12.1
Python ms-python.python 2024.14.1
Python Debugger ms-python.debugpy 2024.12.0
Rainbow CSV mechatroner.rainbow-csv 3.12.0
Remote - SSH ms-vscode-remote.remote-ssh 0.113.1
Remote - SSH: Editing Configuration Files ms-vscode-remote.remote-ssh-edit 0.87.0
Remote Explorer ms-vscode.remote-explorer 0.4.3
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
VS Code Speech ms-vscode.vscode-speech 0.12.1
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-1365U (12 x 2688)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.64GB (16.53GB free)
Process Argv --crash-reporter-id e13b25cb-e144-4923-ade5-764e42b087b5
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupytercf:31046870
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc1:31192215
iacca1:31171482
notype1:31157159
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions