Skip to content

tmp_path: basetemp with retention #10829

Open
@soxofaan

Description

@soxofaan

from the tmp_path how-to docs:

Temporary directories are by default created as sub-directories of the system temporary directory. ... entries older than 3 temporary directories will be removed. ... can be configured with tmp_path_retention_count ...

Using the --basetemp option will remove the directory before every run, effectively meaning the temporary directories
of only the most recent run will be kept.

Is there any particular reason that the retention feature (keep 3 by default) is not supported when --basetemp is used?
It seems like these features should be orthogonal, but that's not the case which is counter-intuitive.

Current workaround is apparently to use the PYTEST_DEBUG_TEMPROOT env var instead of --basetemp but that feature is not documented as far as I could find.

I understand that there are concerns about backward compatibility, but I think basetemp+retention can be implented in a backward compatible way:

  • use --basetemp, but no tmp_path_retention_count config set: use custom temp root without retention (existing behavior)
  • use --basetemp and tmp_path_retention_count: use custom temp root with retention (this feature request)

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin: tmpdirrelated to the tmpdir builtin pluginstatus: help wanteddevelopers would like help from experts on this topictype: 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