fix(cookbook): load user-site pth hooks for runtime installs

Replay user-site .pth hooks when checking cookbook runtime dependencies so packages installed with --user are visible to dependency completion. Includes focused regression coverage.
This commit is contained in:
Pedro Barbosa
2026-06-27 21:01:44 -03:00
committed by GitHub
parent c01c09559a
commit 9782e5bc94
2 changed files with 19 additions and 3 deletions
@@ -106,4 +106,9 @@ def test_local_dependency_probe_refreshes_user_site_visibility():
assert "importlib.invalidate_caches()" in source
assert "user_site = site.getusersitepackages()" in source
assert "if user_site and os.path.isdir(user_site) and user_site not in sys.path:" in source
# addsitedir (not a bare sys.path.append) so user-site `.pth` hooks are
# replayed when a package is installed into an already-running process —
# otherwise setuptools' distutils shim never activates and basicsr-based
# deps (realesrgan) probe as not-installed until a restart. See #4810.
assert "if user_site and os.path.isdir(user_site):" in source
assert "site.addsitedir(user_site)" in source