Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Note lifetime of temporary directories #8038

Merged
merged 1 commit into from Dec 5, 2020

Conversation

matthewhughes934
Copy link
Contributor

Explanation: The default handling of these lifetimes is done in
tmpdir.TempPathFactory.getbasetemp, which passes keep=3 to
pathlib.make_numbered_dir_with_cleanup.

GH Issue: #8036

@matthewhughes934
Copy link
Contributor Author

I wasn't sure if the comment was best placed directly in the reference or in the pydocs.

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -172,7 +172,9 @@ def _mk_tmp(request: FixtureRequest, factory: TempPathFactory) -> Path:
def tmpdir(tmp_path: Path) -> py.path.local:
"""Return a temporary directory path object which is unique to each test
function invocation, created as a sub directory of the base temporary
directory.
directory. After 3 sessions the directory will be removed by default,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to describe the situation in a bit more detail. I suggest writing this in a separate paragraph:

The temporary directory is created under a base directory. By default, a
new base is created each test session, and old bases are removed after 3
sessions, to aid in debugging. If ``--basetemp`` is used then it is
cleared each session. See :ref:`base temporary directory`.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that sounds good, particularly the extra link! I updated with 6a25660. I left out your first sentence since I thought it was sufficiently covered in the existing docs, but I can be persuaded otherwise.

Explanation: The default handling of these lifetimes is done in
`tmpdir.TempPathFactory.getbasetemp`, which passes `keep=3` to
`pathlib.make_numbered_dir_with_cleanup`.

GH Issue: pytest-dev#8036
Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bluetech bluetech merged commit 1a1bb61 into pytest-dev:master Dec 5, 2020
@matthewhughes934 matthewhughes934 deleted the note-tmpdir-lifetime branch December 5, 2020 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants