Skip to content

Is it safe to delete .pytest_cache folder?

Information pytest keeps between test runs, such as which tests failed last time.

Safe

Its owner recreates it by itself when it needs it, and nothing you made is lost.

~/**/.pytest_cache

  • Never inside ~/Library

What it is

pytest saves data between runs in a .pytest_cache folder at the root of a project, including the list of tests that failed in the last run, so it can run those first or on their own. It creates the folder again on the next run.

If it's removed

pytest forgets which tests failed last time, so the next run can't rerun only those tests.

How it's removed

Moved to the Trash, where you can restore it.

PRO

The free analyzer finds it and explains it. Removing it is Pro, after a review sheet that lists every move and command. It starts checked in the Cleanup checklist, except inside Documents or Desktop.

Sources

Last checked on 26 Sep 2026. Every entry is written and checked by hand; the app and the command-line tool use the same words.