Skip to content

fix(ios): raise when no home directory resolves - #624

Merged
gaborbernat merged 4 commits into
tox-dev:mainfrom
XXXXXQ-0206:fix-ios-unknown-home
Oct 17, 2026
Merged

gaborbernat merged 4 commits into
tox-dev:mainfrom
XXXXXQ-0206:fix-ios-unknown-home

Conversation

@XXXXXQ-0206

Copy link
Copy Markdown
Contributor

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?

  • tests/test_ios.py: a new case asserts eight directories raise through the shared _unknown_home fixture,
    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.
  • test_ios_ensure_exists_without_home_creates_nothing now expects the shared "could not determine the home
    directory" prefix, because the resolution guard raises before the creation guard does; its assertion that
    nothing was created is unchanged.
  • Linux (Python 3.12, pwd available): tests/test_ios.py 112 passed; full suite 2249 passed, 125 skipped.
    Windows (Python 3.13): full suite 2024 passed, 350 skipped; the new case skips there because the
    _unknown_home fixture needs pwd.
  • ruff check, ruff format --check and ty check pass.
  • AI disclosure: prepared with AI assistance. Every command and number above was run locally.

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.
Copilot AI balanced review requested due to automatic review settings October 16, 2026 20:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gaborbernat
gaborbernat enabled auto-merge (squash) October 17, 2026 18:01
@gaborbernat
gaborbernat merged commit 91f7775 into tox-dev:main Oct 17, 2026
33 checks passed
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.

3 participants