Skip to content

Improve docs on basetemp and retention #12912

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

Merged
merged 5 commits into from
Oct 31, 2024

Conversation

soxofaan
Copy link
Contributor

Improve coverage of current handling of --basetemp option and its lack of retention functionality.

  • [ ] Include documentation when adding new features.
  • [ ] Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits.
  • Add text like closes #XYZW to the PR description and/or commits (where XYZW is the issue number). See the github docs for more information.
  • Create a new changelog file in the changelog folder, with a name like <ISSUE NUMBER>.<TYPE>.rst. See changelog/README.rst for details.
  • Add yourself to AUTHORS in alphabetical order.

Addresses (part of) issue #10829:
the --basetemp option and the default retention feature can not be combined currently. This is completely unclear from the current docs. While I initially requested to allow the combination of retention with --basetemp in #10829, this PR just attempts better document the current behavior.

Improve coverage of current handling of `--basetemp` option and its lack
of retention functionality.
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Oct 23, 2024
@soxofaan
Copy link
Contributor Author

Note that this PR introduces the exposure of the PYTEST_DEBUG_TEMPROOT env var

from_env = os.environ.get("PYTEST_DEBUG_TEMPROOT")
temproot = Path(from_env or tempfile.gettempdir()).resolve()

I'm not sure if that is desired. Maybe it's only intended as internal implementation detail for testing purposes.

However, I think it's pretty valuable to have this a tool to finetune the "temproot" in practice (e.g. as discussed in #10829 as well)

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.

This is looks much better, thanks!

soxofaan and others added 2 commits October 28, 2024 13:26
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
@soxofaan
Copy link
Contributor Author

Note that this PR introduces the exposure of the PYTEST_DEBUG_TEMPROOT env var

a concern here is that this env var contains "DEBUG" in it's name, which makes it look like it's not ready for production use. As a user I'm not interested to use this for one-off debug use cases, I want to use this in real CI contexts.

Is there opportunity to rename this env var to, for example, PYTEST_TEMPROOT ?

@nicoddemus
Copy link
Member

Regardless if we want to rename or not, we should document the existing var -- renaming it should be discussed in a separate issue.

@soxofaan
Copy link
Contributor Author

I'm suggesting the rename here as it seems less cumbersome to do a rename before it making a publicly documented feature than the other way around.

@soxofaan
Copy link
Contributor Author

FYI I'm just assuming PYTEST_DEBUG_TEMPROOT is an undocumented implementation detail, as I couldn't find any pointers in public online docs. But maybe there is already usage in the wild

@soxofaan
Copy link
Contributor Author

but indeed, regardless, you still have to document something like

before pytest version x.y.z you have to use PYTEST_DEBUG_TEMPROOT instead of PYTEST_TEMPROOT.

@nicoddemus
Copy link
Member

FYI I'm just assuming PYTEST_DEBUG_TEMPROOT is an undocumented implementation detail, as I couldn't find any pointers in public online docs. But maybe there is already usage in the wild

You are right in your assumption, but it seems it is used in the wild:

https://github.com/search?q=PYTEST_DEBUG_TEMPROOT&type=code

So we do need to document it regardless, even if we were to change it later (which I don't think is something worthwhile to do).

@nicoddemus
Copy link
Member

Thanks @soxofaan, looks great!

I will leave it open for a few more days to give others a chance to chime in. 👍

@nicoddemus nicoddemus merged commit a1a4918 into pytest-dev:main Oct 31, 2024
29 checks passed
@nicoddemus nicoddemus added the backport 8.3.x apply to PRs at any point; backports the changes to the 8.3.x branch label Oct 31, 2024
Copy link

patchback bot commented Oct 31, 2024

Backport to 8.3.x: 💚 backport PR created

✅ Backport PR branch: patchback/backports/8.3.x/a1a491837b35b719d77b4f03be318b505d495386/pr-12912

Backported as #12928

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 31, 2024
Improve coverage of current handling of `--basetemp` option and its lack of retention functionality.

Also document `PYTEST_DEBUG_TEMPROOT`.

Related to #10829

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
(cherry picked from commit a1a4918)
nicoddemus pushed a commit that referenced this pull request Oct 31, 2024
Improve coverage of current handling of `--basetemp` option and its lack of retention functionality.

Also document `PYTEST_DEBUG_TEMPROOT`.

Related to #10829

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
(cherry picked from commit a1a4918)

Co-authored-by: Stefaan Lippens <soxofaan@users.noreply.github.com>
Glyphack pushed a commit to Glyphack/pytest that referenced this pull request Nov 23, 2024
Improve coverage of current handling of `--basetemp` option and its lack of retention functionality.

Also document `PYTEST_DEBUG_TEMPROOT`.

Related to pytest-dev#10829

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 8.3.x apply to PRs at any point; backports the changes to the 8.3.x branch bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants