Skip to content

Test suite is unrunnable on Windows without symlink privilege: utils_temp_dir errors #2021

Closed

Description

@iam-kira

with suppress(FileExistsError):
(tmp_path / util_path.name).symlink_to(util_path)
Windows refuses symlink creation unless the process is elevated or Developer Mode is enabled. That raises OSError: [WinError 1314], which is not a FileExistsError, so suppress does not catch it and the fixture errors.

utils_temp_dir feeds pipx_temp_env, which most tests depend on, so effectively the whole suite errors on a normal Windows machine:

ERROR tests/test_uninstall_all.py::test_uninstall_all - OSError: [WinError 1314]
ERROR tests/test_uninstall_all.py::test_uninstall_all_legacy_venv[None] - OSError...
5 errors in 1.94s
Why CI doesn't catch it
tests.yml includes windows-2025, and it is green — those runners can create symlinks. The failure only appears for an unprivileged contributor, so the suite is permanently green in CI and permanently broken locally.

Suggested fix (implemented and verified)
Fall back to putting the utility's real directory on PATH when the symlink cannot be created. Copying or hard-linking is not an alternative: Windows resolves an executable's DLLs relative to its image path, and git.exe needs the siblings in mingw64/bin.

utils_temp_dir is referenced only inside conftest.py (three places), so returning a list of directories instead of one path is contained.

Result on Windows: tests/test_uninstall_all.py goes from 5 errors to 5 passed.

Patch: patches/pipx/0001-tests-make-utils_temp_dir-work-without-symlink-privi.patch

Environment
Windows-11-10.0.26200-SP0
Python 3.13.15
git core.symlinks=false (default for a non-elevated Windows user)

Activity

  1. added a commit that references this issue on Aug 30, 2026
    277f161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions