Skip to content

repeating a test spams pytest cache #84

@dpinol

Description

@dpinol

When running many repeatitions of a test with --count, .pytest_cache/v/cache/nodeids may get up to millions of entries. Eg:

"test/utils/test_types.py::test_if_none[1-100]",
  "test/utils/test_types.py::test_if_none[10-100]",
  "test/utils/test_types.py::test_if_none[100-100]",
  "test/utils/test_types.py::test_if_none[11-100]",
  "test/utils/test_types.py::test_if_none[12-100]",
...

This may cause a lag of several seconds even after executing a single method with -k specifying a single test file.

The culprit is pytest_sessionfinish in cacheprovider.py, when calling config.cache.set("cache/nodeids", sorted(self.cached_nodeids)). When cached_nodeids contains milions of entries, this function always generates a json with the whole contents of .pytest_cache/v/cache/nodeids.

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