Skip to content

Cleaning up tmpdir's #1120

@The-Compiler

Description

@The-Compiler

Currently it seems pytest never cleans up the temporary directories it creates. Is this intended?

I can see how it can be useful when tests fail and one wants to inspect the contents of the temporary folder - but it can also cause a lot of trouble with long-running systems (I had the harddisk of a VM fill up because >2 GB of pytest tempfiles accumulated) or systems not cleaning the tempdir (Windows, I'm looking at you!).

I can think of some solutions to this:

  • Add a new argument and always clean up tempdirs after a test unless that argument is given.
  • Only clean up tempdirs for passing tests, and keep them for failing tests
  • Clean up tempdirs after x runs (when a new run is started), or after they reached a certain age treshold.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueeasy issue that is friendly to new contributorplugin: tmpdirrelated to the tmpdir builtin pluginstatus: help wanteddevelopers would like help from experts on this topic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions