Skip to content

pytest discovery broken in v2024.22.1 #24660

Closed as duplicate
Closed as duplicate

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:

Activity

  1. Axel-Vivien commented on Dec 27, 2024

    @Axel-Vivien

    Also affected by this

  2. jcfrt commented on Dec 27, 2024

    @jcfrt

    I have a similar issue, test discovery never completes.
    Rolling back to v2024.22.0 and restarting VS code entirely (not just restarting the Extension Host) did work around the issue.

  3. roablep commented on Dec 27, 2024

    @roablep

    +1. Discovery works again after downgrading to 2024.22.0 (from 2024.22.1)

  4. hchau630 commented on Dec 27, 2024

    @hchau630

    I think this issue has already been reported in #24656.

  5. andypohl commented on Dec 27, 2024

    @andypohl

    I don't use pytest and I'm having the same issue so I went back to 2024.22.0 and it's working again for unittest.

  6. roablep commented on Dec 28, 2024

    @roablep

    I'm curious how many VS Code users spent as much time as I did before finally realizing it was the plug-in version change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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