File tree Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1+ Fix remaining test failures in Python 3.14 by adjusting ``path_to_url `` and similar functions.
Original file line number Diff line number Diff line change 66import os
77import posixpath
88import re
9+ import sys
910import urllib .parse
1011from collections .abc import Mapping
1112from dataclasses import dataclass
@@ -131,7 +132,11 @@ def _clean_file_url_path(part: str) -> str:
131132 # should not be quoted. On Linux where drive letters do not
132133 # exist, the colon should be quoted. We rely on urllib.request
133134 # to do the right thing here.
134- return urllib .request .pathname2url (urllib .request .url2pathname (part ))
135+ ret = urllib .request .pathname2url (urllib .request .url2pathname (part ))
136+ if sys .version_info >= (3 , 14 ):
137+ # https://discuss.python.org/t/pathname2url-changes-in-python-3-14-breaking-pip-tests/97091
138+ ret = ret .removeprefix ("//" )
139+ return ret
135140
136141
137142# percent-encoded: /
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ def path_to_url(path: str) -> str:
1212 quoted path parts.
1313 """
1414 path = os .path .normpath (os .path .abspath (path ))
15- url = urllib .parse .urljoin ("file:" , urllib .request .pathname2url (path ))
15+ url = urllib .parse .urljoin ("file:// " , urllib .request .pathname2url (path ))
1616 return url
1717
1818
Original file line number Diff line number Diff line change 1111def test_path_to_url_unix () -> None :
1212 assert path_to_url ("/tmp/file" ) == "file:///tmp/file"
1313 path = os .path .join (os .getcwd (), "file" )
14- assert path_to_url ("file" ) == "file://" + urllib . request . pathname2url ( path )
14+ assert path_to_url ("file" ) == "file://" + path
1515
1616
1717@pytest .mark .skipif ("sys.platform != 'win32'" )
You can’t perform that action at this time.
0 commit comments