Skip to content

Commit

Permalink
Avoid modifying path placeholders created by editable installs
Browse files Browse the repository at this point in the history
The setuptools implementation of editable installs will insert a
placeholder entry into sys.path as part of its magic to register its
custom import mechanism.

These are not real filesystem paths and as such should not be
rewritten to absolute paths.
  • Loading branch information
jeremy-hiatt committed Feb 28, 2024
1 parent f57c658 commit 51ef944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/1028.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix compatiblity issue between `looponfail` and editable installs.
3 changes: 2 additions & 1 deletion src/xdist/looponfail.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ def init_worker_session(channel, args, option_dict):
newpaths = []
for p in sys.path:
if p:
if not os.path.isabs(p):
# Ignore path placeholders created for editable installs
if not os.path.isabs(p) and not p.endswith(".__path_hook__"):
p = os.path.abspath(p)
newpaths.append(p)
sys.path[:] = newpaths
Expand Down

0 comments on commit 51ef944

Please sign in to comment.