Skip to content

Commit e0d869b

Browse files
committed
test(sandbox): make local read error regression portable
1 parent a63403b commit e0d869b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/sandbox/test_entries.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ async def test_local_file_preserves_local_read_error_when_write_wraps_stream_fai
281281
source = (tmp_path / "source.txt").resolve()
282282
source.write_bytes(b"original")
283283
session = _PayloadWrappingWriteSession()
284-
original_open = Path.open
284+
source_path_type = type(source)
285+
original_open = source_path_type.open
285286

286287
def failing_open(
287288
self: Path,
@@ -295,7 +296,7 @@ def failing_open(
295296
return _FailAfterChunkStream(b"original")
296297
return cast(io.IOBase, original_open(self, mode, buffering, encoding, errors, newline))
297298

298-
monkeypatch.setattr(Path, "open", failing_open)
299+
monkeypatch.setattr(source_path_type, "open", failing_open)
299300

300301
with pytest.raises(LocalFileReadError) as excinfo:
301302
await LocalFile(src=Path("source.txt")).apply(

0 commit comments

Comments
 (0)