fix: accept use_site_for_root in the bin functions - #537
Merged
gaborbernat merged 3 commits intoSep 1, 2026
Conversation
user_bin_dir on Unix redirects root to site_bin_dir when use_site_for_root is set, the same way the data/config/cache/state/log/runtime directories do. Of those seven redirected properties it was the only one whose module-level function took no arguments, so the redirect was unreachable through user_bin_dir() and user_bin_path() - same shape as the user_preference_dir gap fixed in tox-dev#531. The parameter is keyword-only since it has never shipped on these functions. The new test runs every site-redirect case through the module-level function as well, in both dir and path form, so the next property added to the redirect list gets this check for free.
gaborbernat
force-pushed
the
fix-user-bin-dir-use-site-for-root
branch
2 times, most recently
from
September 1, 2026 04:31
103dfd7 to
428cb0b
Compare
_SITE_REDIRECT_CASES listed seven of the eight properties Unix redirects under use_site_for_root, so user_applications_dir went untested by the three tests that read the list and by the new one. Breaking that redirect now fails three cases instead of none. Its expected value interpolates os.sep, which matches the joined production path on Windows and needs no os-path-join suppression. The new test drops the typed dict and the if. It filters the options by what each signature accepts, and builds the function name with removesuffix rather than a replace that does nothing for the dir variant.
gaborbernat
force-pushed
the
fix-user-bin-dir-use-site-for-root
branch
from
September 1, 2026 04:34
428cb0b to
edbbd9c
Compare
gaborbernat
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the reach gaps closed in #531 and #534, found by checking the rest of the module-level functions against the properties they wrap.
On Unix, the
user_bin_dirproperty redirects root tosite_bin_dirwhenuse_site_for_rootis set, the same way data/config/cache/state/log/runtime do. Of those seven redirected properties,user_bin_dirwas the only one whose module-level function took no arguments, so the redirect was unreachable through the function API:This gives
user_bin_diranduser_bin_paththe one argument that carries behaviour. The other constructor arguments would be dead weight here: no platform scopes its bin directories to the app, and no platform's bin property calls_optionally_create_directory, soappname/version/ensure_existscan't affect the result. The parameter is keyword-only since it has never shipped on these functions, per the reasoning in #534.The new test runs every
_SITE_REDIRECT_CASESentry through the module-level function as well, in both_dirand_pathform. Checked it the hard way: reverting__init__.pyfails exactly theuser_bin_dircase with the originalTypeError, and keeping the signature while dropping the forwarding fails on the value. The_pathleg exists because my first version only covered_dirand a non-forwardinguser_bin_pathmutant slipped straight through it.Testing: full suite on Windows with 3.14, 1072 passed / 94 skipped (baseline 1058/94), ruff and ty clean. Linux and macOS legs unrun here.