Skip to content

PATH for selected Venv not used when pytest test run via Run Test  #23467

Closed as not planned
@andrewstevens-infineon

Description

@andrewstevens-infineon

venv_selected
Type: Bug

Behaviour

When a pytest test is launched using the "Run Test" Button/Command the environment of the selected virtualenv appears not to be set. This contrasts with the behaviour when "Debug Test" Button/Command is used where the Venv environment is used. This will (for example) break test suites relying on finding executables installed in the virtualenv bin directory on PATH.

Steps to reproduce:

  1. Create small pytest test suite.
  2. print(os.environ) in test.
import os

def test_environ():
    print("PATH", os.environ["PATH"])

See attached output captured from run.
Debug_test_run_output.log
Run_test_run_output.log

Diagnostic data

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

N/A

Extension version: 2024.6.0
VS Code version: Code 1.89.1 (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:13:33.891Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 5.15.146.1-microsoft-standard-WSL2

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


languageServer: "Pylance"

testing
• pytestEnabled: true

Installed Extensions
Extension Name Extension Id Version
C/C++ ms-vscode.cpptools 1.20.5
C/C++ Extension Pack ms-vscode.cpptools-extension-pack 1.3.0
CMake twxs.cmake 0.0.17
CMake Tools ms-vscode.cmake-tools 1.17.17
JavaScript Debugger ms-vscode.js-debug 1.89.0
Pylance ms-python.vscode-pylance 2024.5.1
Python ms-python.python 2024.6.0
Python Debugger ms-python.debugpy 2024.6.0
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-12800H (20 x 2803)
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
Load (avg) undefined
Memory (System) 31.64GB (3.06GB free)
Process Argv --crash-reporter-id ec714d14-a794-4eea-900c-f84b7a0f633c
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-22.04
OS Linux x64 5.15.146.1-microsoft-standard-WSL2
CPUs 12th Gen Intel(R) Core(TM) i7-12800H (20 x 2803)
Memory (System) 15.44GB (9.38GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
chatpanelt:31048053
dsvsc021:30996838
jg8ic977:31013176
pythoncenvptcf:31049071
a69g1124:31046351
pythonprt:31056678
dwnewjupytercf:31046870
26j00206:31048877

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions