Skip to content

Commit

Permalink
Suppress OSErrors when checking for script presence. Fixes #70.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 15, 2023
1 parent 30cf35c commit 2057380
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v10.0.7
=======

#70: Avoid OSError when a parameter to Python exceeds the
allowed filename length.

v10.0.6
=======

Expand Down
3 changes: 2 additions & 1 deletion pip_run/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def search(cls, params):
in a script indicated in the parameters. Only honor the
first file found.
"""
files = filter(pathlib.Path.is_file, map(pathlib.Path, params))
safe_is_file = suppress(OSError)(pathlib.Path.is_file)
files = filter(safe_is_file, map(pathlib.Path, params))
return cls.try_read(next(files, None)).params()

def read(self):
Expand Down
1 change: 0 additions & 1 deletion tests/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def test_comment_style(self):
reqs = scripts.DepsReader(script).read()
assert reqs == ['foo==3.1']

@pytest.mark.xfail(reason="#70")
def test_search_long_parameter(self):
"""
A parameter that is too long to be a filename should not fail.
Expand Down

0 comments on commit 2057380

Please sign in to comment.