Repository navigation
fix(ios): raise when no home directory resolves - #624
Merged
Merged
Conversation
IOS() built its directories from a literal ~ when no home resolved, while MacOS() and Unix() raised the same error. Route the 16 iOS paths through _expand_user, as macOS and Unix already do, and cover them with the _unknown_home fixture. The existing test_ios_ensure_exists_without_home_creates_nothing asserted the creation guard's message; both guards share the 'could not determine the home directory' prefix, so its expectation now matches that prefix.
gaborbernat
approved these changes
Oct 17, 2026
gaborbernat
enabled auto-merge (squash)
October 17, 2026 18:01
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.
What does this PR do?
IOS() built its directories from a literal ~ when no home directory resolved, because it called
os.path.expanduser directly: that returns the path unchanged when the home is unknown, while the
comment above those calls claimed it raises. MacOS() and Unix() already route the same ~/Library/...
paths through _expand_user, which raises RuntimeError in that case, so IOS() now does too.
Related issue or discussion
Follow-up to #589, which made an unknown home raise for macOS and Unix but missed the iOS module.
How did you test it?
mirroring the existing macOS case. The existing iOS case only covers the ensure_exists creation guard;
it passed even while user_data_dir still returned a literal ~, so this adds the missing resolution guard.
It fails with the source change reverted and passes with it.
directory" prefix, because the resolution guard raises before the creation guard does; its assertion that
nothing was created is unchanged.
Windows (Python 3.13): full suite 2024 passed, 350 skipped; the new case skips there because the
_unknown_home fixture needs pwd.