Skip to content

flag to cleanup generated tmp_path objects #7465

Description

@kjaymiller

When using the tmp_path factory, the path remains until:

  • The system is restarted
  • The number of tmp_path objects is greater than the limit (currently 3)
  • a basepath is given (This will just overwrite the existing basepath, but will not provide any cleanup).

I propose a flag that cleans up tmp_path objects on completion of the test.

Usage would look like

python -m pytest --autocleanup

This would execute the following steps:

  1. create a list of each tmp_path object created.
  2. execute code
  3. iterate through the list deleting each tmp_path that was created (if it still exists)

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: tmpdirrelated to the tmpdir builtin plugintype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions