Skip to content

Fix Windows Blender discovery test PosixPath on Python 3.13 - #17

Merged
10-X-eng merged 1 commit into
stevecad:mainfrom
M3NT8L-One:fix/windows-posixpath-test
Nov 6, 2026
Merged

10-X-eng merged 1 commit into
stevecad:mainfrom
M3NT8L-One:fix/windows-posixpath-test

Conversation

@M3NT8L-One

Copy link
Copy Markdown
Contributor

What doesn't work

test_windows_discover_keeps_program_files_layout builds its Program Files fixture with path_type=PosixPath and asserts with PosixPath(path).is_file(). On native Windows, Python 3.13 refuses to construct PosixPath (the same rule blocks WindowsPath on macOS and Linux), so the test can't run on the platform it covers. Thanks to @TheronRogers for flagging this on #15.

The change

The test takes the host's own path class (host_path = type(Path())) before the platform mocks and passes it to _candidates and is_file(), and the PosixPath import is removed. Discovery still gets a real path class that can reach the temp folder on any OS, and the Program Files layout check is unchanged.

Tests

python -m unittest tests.test_blender_runtime passes 15/15 before and after on macOS (Apple Silicon, Python 3.13). Not run on native Windows; a Windows check from a maintainer or Theron would be welcome. 1 file, +9/−5.

Python 3.13 refuses to construct PosixPath on native Windows. Capture the
host concrete Path subclass before the platform mocks so the Program Files
fixture still works on every OS.

@10-X-eng 10-X-eng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, this looks right. Taking host_path = type(Path()) before the platform mocks is the key detail: Path() under the patched os.name would pick WindowsPath on Linux and fail.

  • Linux and macOS: host_path is still PosixPath, so the test behaves as it did before.
  • Windows: host_path is WindowsPath, so both _candidates and the is_file() check in fake_probe can reach the temp folder. The Program Files layout assertions are unchanged.

The change only touches tests/test_blender_runtime.py, so app behaviour isn't affected.

Two small notes, neither blocking:

  • The comment in fake_probe about pathlib.Path missing the file only describes non-Windows hosts.
  • The rest of this file writes assignments as x=y, while host_path = type(Path()) has spaces.

As you said, this hasn't been run on native Windows yet, so a run there would still be a useful confirmation.

Thanks, this looks good to us! Outside changes always get a final look from a maintainer before they go in.

@10-X-eng
10-X-eng merged commit 66aa596 into stevecad:main Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants