Skip to content

pytest always creates the .cache directory even when the cache functionality is not used #1342

@svetlin-mladenov

Description

@svetlin-mladenov

pytest creates the .cache directory even when no tests are actually executed and the cache functionality is not used at all. In a sense the user pays for what they are not using.

Here is an example where no tests are actually run:

rm .cache/ -rf
truncate empty.py --size 0
py.test empty.py # warns that no tests were run
ls -lad .cache # suprise !

In this example only a single empty test is run but still .cache is created:

rm .cache/ -rf
echo -e "def test_minimal():\n    pass" > minimal.py
py.test minimal.py
ls -lad .cache # suprise !

This issue is clearly related to issue #1029 but is not limited to read-only file systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: cacherelated to the cache builtin pluginstatus: help wanteddevelopers would like help from experts on this topictype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions