Type: Bug
Behaviour
Python test discovery is run on change to any ".py" file, even non-test files. Previously, test discovery seems to run only if any "test_*" files changed, but now, any opened ".py" file that has been changed triggers discovery.
I have a really large test suite, and test collection takes a couple of seconds, too much to wait it on any file save.
As a consequence, I can't use "restart debug session" (Debug: Restart) action, as save is forcibly triggering test discovery, and Debug: Restart action stops as test is shown as unknown (same icon as skipped test).
Steps to reproduce:
- Open python source and test file.
- Save a change in python file.
- Check that test discovery was triggered.
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2026-03-17 14:14:25.385 [info] [test-by-project] Cleaned up 1 test items for workspace: /home/some_code_directory
2026-03-17 14:14:25.385 [info] [test-by-project] Discovering projects for workspace: /home/some_code_directory
2026-03-17 14:14:25.385 [info] [test-by-project] Found 1 total Python projects from API
2026-03-17 14:14:25.385 [info] [test-by-project] Filtered to 1 projects in workspace
2026-03-17 14:14:25.385 [info] [test-by-project] Creating adapter for: python-information-extractors at file:///home/some_code_directory
2026-03-17 14:14:25.386 [info] [test-by-project] Registered 1 project(s) for /home/some_code_directory
2026-03-17 14:14:25.391 [info] [test-by-project] Starting discovery for 1 project(s) in workspace
2026-03-17 14:14:25.391 [info] [test-by-project] Discovering tests for project: python-information-extractors (Python 3.12)
2026-03-17 14:14:25.393 [info] arg: --rootdir already exists in args, not adding.
2026-03-17 14:14:25.393 [info] Environment variables set for pytest discovery: PYTHONPATH=/home/myusername/.vscode/extensions/ms-python.python-2026.4.0-linux-x64/python_files, TEST_RUN_PIPE=/run/user/1000/python-test-discovery-907b80b6331243033c33
2026-03-17 14:14:25.393 [info] Using environment extension for pytest discovery in workspace /home/some_code_directory
2026-03-17 14:14:25.396 [info] Started pytest discovery subprocess (environment extension) for workspace /home/some_code_directory
2026-03-17 14:14:25.851 [info] ============================= test session starts ==============================
platform linux -- Python 3.12.8, pytest-9.0.2, pluggy-1.5.0 -- /home/some_code_directory/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/some_code_directory
configfile: pyproject.toml
plugins: celery-1.2.0, pytest_docker_tools-3.1.9, cov-6.1.1, typeguard-4.4.2, xdist-3.6.1, asyncio-1.3.0, rerunfailures-15.1
asyncio: mode=Mode.STRICT, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
Extension version: 2026.4.0
VS Code version: Code 1.111.0 (ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb, 2026-03-06T23:06:10Z)
OS version: Linux x64 6.17.0-19-generic
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.12.3.final.0
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
- Value of the
python.languageServer setting: Pylance
User Settings
languageServer: "Pylance"
testing
• promptToConfigure: false
• pytestArgs: "<placeholder>"
• pytestEnabled: true
experiments
• optOutFrom: ["pythonTerminalEnvVarActivation"]
Installed Extensions
| Extension Name |
Extension Id |
Version |
| black-formatter |
ms- |
2025.2.0 |
| claude-code |
Ant |
2.1.77 |
| code-spell-checker |
str |
4.5.6 |
| code-spell-checker-slovenian |
str |
0.2.5 |
| debugpy |
ms- |
2025.18.0 |
| even-better-toml |
tam |
0.21.2 |
| gitlens |
eam |
17.11.1 |
| js-debug |
ms- |
1.110.0 |
| js-debug-companion |
ms- |
1.1.3 |
| markdown-all-in-one |
yzh |
3.6.3 |
| mypy-type-checker |
ms- |
2025.2.0 |
| open-html-in-browser |
pea |
2.1.10 |
| postman-for-vscode |
Pos |
1.19.1 |
| python |
ms- |
2026.4.0 |
| redis-for-vscode |
Red |
1.4.0 |
| ruff |
cha |
2026.36.0 |
| vscode-js-profile-table |
ms- |
1.0.10 |
| vscode-pylance |
ms- |
2026.1.1 |
| vscode-python-envs |
ms- |
1.22.0 |
| vscode-speech |
ms- |
0.16.0 |
| vscode-yaml |
red |
1.21.0 |
| xml |
Dot |
2.5.1 |
System Info
| Item |
Value |
| CPUs |
12th Gen Intel(R) Core(TM) i7-12700H (20 x 3166) |
| GPU Status |
2d_canvas: enabled GPU0: VENDOR= 0x10de, DEVICE=0x25a0, DRIVER_VENDOR=Mesa, DRIVER_VERSION=25.2.8 GPU1: VENDOR= 0x8086, DEVICE=0x46a6, DRIVER_VENDOR=Mesa, DRIVER_VERSION=25.2.8 ACTIVE 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: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off webnn: disabled_off |
| Load (avg) |
1, 1, 1 |
| Memory (System) |
31.04GB (17.50GB free) |
| Process Argv |
/home/domenj/pl_code/python-information-extractors/python-information-extractors.code-workspace --crash-reporter-id 6d211005-42ef-4cb9-9471-5fe05dfc6e5f --crash-reporter-id 6d211005-42ef-4cb9-9471-5fe05dfc6e5f |
| Screen Reader |
no |
| VM |
0% |
| DESKTOP_SESSION |
ubuntu-wayland |
| XDG_CURRENT_DESKTOP |
ubuntu:GNOME |
| XDG_SESSION_DESKTOP |
ubuntu-wayland |
| XDG_SESSION_TYPE |
wayland |
A/B Experiments
vsliv368cf:30146710
vswsl492cf:30256860
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
82j33506:31327384
6abeh943:31336334
envsactivate1:31464700
editstats-enabled:31346257
cloudbuttont:31379625
aihoversummaries_f:31469309
3efgi100_wstrepl:31403338
use-responses-api:31390855
ec5jj548:31422691
cp_cls_c_966_ss:31454199
4je02754:31466945
7a04d226_do_not_restore_last_panel_session:31438103
cp_cls_c_1081:31454833
a43f0575b:31442825
e9c30283:31461165
test_treatment2:31471001
idci7584:31464702
edit_mode_hidden:31461530
e3e4d672:31461204
864ei723_large_tool_results_to_disk:31460878
notips:31471632
b1f5h706:31471673
chat:31457767
cpptoolsoff-v2:31475362
4dgh1208:31471592
noaffordance1:31474146
c3257622:31473910
commenticon:31473926
h08i8180:31475369
ddid_t:31478206
Type: Bug
Behaviour
Python test discovery is run on change to any ".py" file, even non-test files. Previously, test discovery seems to run only if any "test_*" files changed, but now, any opened ".py" file that has been changed triggers discovery.
I have a really large test suite, and test collection takes a couple of seconds, too much to wait it on any file save.
As a consequence, I can't use "restart debug session" (
Debug: Restart) action, as save is forcibly triggering test discovery, andDebug: Restartaction stops as test is shown as unknown (same icon as skipped test).Steps to reproduce:
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)Extension version: 2026.4.0
VS Code version: Code 1.111.0 (ce099c1ed25d9eb3076c11e4a280f3eb52b4fbeb, 2026-03-06T23:06:10Z)
OS version: Linux x64 6.17.0-19-generic
Modes:
python.languageServersetting: PylanceUser Settings
Installed Extensions
System Info
GPU0: VENDOR= 0x10de, DEVICE=0x25a0, DRIVER_VENDOR=Mesa, DRIVER_VERSION=25.2.8
GPU1: VENDOR= 0x8086, DEVICE=0x46a6, DRIVER_VENDOR=Mesa, DRIVER_VERSION=25.2.8 ACTIVE
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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
A/B Experiments