Skip to content

Commit 737d96a

Browse files
authored
Merge pull request #3249 from A5rocks/fix-3.14-deprecation
Switch from `PurePath#as_uri` to `PurePath#joinpath` for our test that PurePath methods get inherited
2 parents f500503 + b7177b0 commit 737d96a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/trio/_path.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ def __repr__(self) -> str:
244244
if sys.version_info >= (3, 13):
245245
full_match = _wrap_method(pathlib.Path.full_match)
246246

247+
def as_uri(self) -> str:
248+
return pathlib.Path.as_uri(self)
249+
247250

248251
@final
249252
class PosixPath(Path, pathlib.PurePosixPath):

src/trio/_tests/test_path.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,8 @@ def test_forward_properties_rewrap(path: trio.Path) -> None:
168168
assert isinstance(path.parent, trio.Path)
169169

170170

171-
async def test_forward_methods_without_rewrap(path: trio.Path) -> None:
172-
path = await path.parent.resolve()
173-
174-
assert path.as_uri().startswith("file:///")
171+
def test_forward_methods_without_rewrap(path: trio.Path) -> None:
172+
assert "totally-unique-path" in str(path.joinpath("totally-unique-path"))
175173

176174

177175
def test_repr() -> None:
@@ -232,6 +230,12 @@ async def test_globmethods(path: trio.Path) -> None:
232230
assert entries == {"_bar.txt", "bar.txt"}
233231

234232

233+
async def test_as_uri(path: trio.Path) -> None:
234+
path = await path.parent.resolve()
235+
236+
assert path.as_uri().startswith("file:///")
237+
238+
235239
async def test_iterdir(path: trio.Path) -> None:
236240
# Populate a directory
237241
await path.mkdir()

0 commit comments

Comments
 (0)