Skip to content

Pytest 8.0.2 may collect tests multiple times under Windows #12039

Closed
@mrbean-bremen

Description

@mrbean-bremen

I'm not quite sure if this is a bug, or a problem with the test or GitHub Actions, but since version 8.0.2 a test in pytest-order fails in the CI under Windows, which worked fine in 8.0.1 and previous versions. Linux and macOS tests are not affected.

Pytest run environment in the CI:

platform win32 -- Python 3.11.8, pytest-8.0.2, pluggy-1.4.0 -- D:\a\pytest-order\pytest-order\.tox\py311-pytest80\Scripts\python.EXE
cachedir: .tox\py311-pytest80\.pytest_cache
rootdir: D:\a\pytest-order\pytest-order
plugins: cov-2.9.0, dependency-0.6.0, mock-3.12.0, xdist-3.5.0

The same happens for Python 3.8 - 3.12.

The actual test should collect 6 items (3 tests per test module, in 2 modules) that are created in the directory provided by the tempdir fixture,
but collects 24 tests in the CI instead. Locally, it works as expected.

Checking the failed tests revealed that the tests have been collected from different locations. The tempdir had been at:
C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-9\\test_xdist_ordering0
(for a specific run), but the same tests have been discovered with a test ID with just the qualified test name, and additionally with the test IDs:
::::Users::runneradmin::AppData::Local::Temp::pytest-of-runneradmin::pytest-9:::xxx and
::::Documents and Settings::runneradmin::AppData::Local::Temp::pytest-of-runneradmin::pytest-9::xxx,
which are most likely aliases.

I haven't dug into this yet, but I suspect it may have something to do with the fix for the problem with short paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions