Skip to content

VSC will not recognize tests #24816

@elutins

Description

@elutins

Type: Bug

Behaviour

Expected vs. Actual

Expected: VSC to correctly discover and load all test files in the Testing panel.

Actual: VSC fails to recognize any test files. VSC will attempt to find test (after re-running Tests: Refresh Tests in command pallette), but does not succeed.

Steps to reproduce:

Here is a layout of my current directory containing test files
tree

├─projects
├    |── __init__.py
├    |── subfolder1
├        ├─ __init__.py
├        ├─ subfolder2
├           |── __init__.py
├           |── test_file.py

And here is a python snippet from my settings.json

"python.testing.pytestArgs": [
        "."
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true,

I tried downgrading the Python vscode extension to version 2022.8 per this issue, but still no luck.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.2
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Micromamba (also tested in a conda environment)
  • Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

NA - no output is shown in Output Panel

User Settings


languageServer: "Pylance"

formatting
• provider: "black"
• blackArgs: "<placeholder>"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

Extension version: 2022.8.0
VS Code version: Code 1.97.0 (Universal) (33fc5a94a3f99ebe7087e8fe79fbe1d37a251016, 2025-02-04T22:41:26.688Z)
OS version: Darwin arm64 24.3.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 2400)
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
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 4, 5, 5
Memory (System) 32.00GB (2.67GB free)
Process Argv --crash-reporter-id 40779e06-2e24-4d81-b5c4-dafb19b092f8
Screen Reader no
VM 0%

Metadata

Metadata

Assignees

Labels

area-testinginfo-neededIssue requires more information from postertriage-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