Skip to content

pytest discovery broken in v2024.22.1Β #24660

@maxhoheiser

Description

@maxhoheiser

Type: Bug

Behaviour

Pytest discovery is stuck after finding all pytests displaying the last test - but does not display them in the side panel. Switching to the previous version - pytest discovery works as expected: the same tests are discovered and immediately test collection finishes.

Steps to reproduce:

  1. pytest sample with this settings
{
  // Pytest configurations
  "python.testing.pytestArgs": [
    "backend/tests",
    "-s",
    "--no-cov",
    "--envfile=.env.test"
  ],
  "python.testing.unittestEnabled": false,
  "python.testing.pytestEnabled": true,
  // // "python.analysis.extraPaths": ["/"],
  "python.envFile": "${workspaceFolder}/.env.development.local",
}

tests are in /backend/tests/unitand /backend/tests/integration the code is in /backend/appname and I am using this pyproject.toml file

[project]
name = "appname"
version = "0.0.1"
description = "AppName"
readme = {file = "README.md", content-type = "text/markdown; charset=UTF-8"}
requires-python = ">=3.12"
authors = [
    {name = "xxx", email = "xxx"}
]

dependencies = [
    "fastapi",
    "sqlalchemy",
    "pydantic",
    "python-dotenv",
    "passlib",
    "psycopg2",
    "passlib[argon2]",
    "email_validator",
    "tldextract"
]

[project.optional-dependencies]
test = [
    "pytest",
    "pytest_httpserver",
    "docker",
    "sqlalchemy_utils",
    "pytest-dotenv",
    "pytest-cov",
]

dev = [
    "acesotrack[test]",
    "alembic",
    "ruff",
    "mypy",
    "pre-commit"
]

[build-system]
requires = ["setuptools>=75"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
package-dir = {"" = "backend"}
packages = ["appname"]

Problem

for the new extension, the trace output of python shows exactly the same tests as being discovered, but it is stuck before it can finish the test discovery
Image

Extension version: 2024.22.0
VS Code version: Code 1.96.2 (fabdb6a30b49f79a7aba0f2ad9df9b399473380f, 2024-12-19T10:22:47.216Z)
OS version: Darwin x64 23.5.0
Modes:

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-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