#1061
[1.0.0] OSAccess: unlink after rename raises KeyError on the old name
Summary
After Path.rename, the renamed file reports exists() == True, but unlink() on the new name raises KeyError with the old name. OSAccess seems to keep a stale entry under the old key.
Minimal reproduction
import pydantic_monty as m
code = """
from pathlib import Path
Path('/r').write_text('x')
Path('/r').rename('/r2')
print(Path('/r2').exists())
Path('/r2').unlink()
"""
with m.Monty() as pool, pool.checkout() as s:
s.feed_run(code, print_callback=m.CollectStreams(), os=m.OSAccess())This prints True, then raises MontyRuntimeError: KeyError: r.
Activity
0No activity yet.