mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-24 10:32:45 +00:00
fix(memory): clean atomic write test hygiene
Made-with: Cursor
This commit is contained in:
parent
53ca2836e7
commit
3d7099b421
@ -170,18 +170,13 @@ class TestHistoryWithCursor:
|
||||
tmp_path_obj = store.history_file.with_suffix(".jsonl.tmp")
|
||||
|
||||
# Mock os.replace to raise an exception
|
||||
original_replace = __import__('os').replace
|
||||
|
||||
def failing_replace(*args, **kwargs):
|
||||
raise RuntimeError("Simulated failure")
|
||||
|
||||
monkeypatch.setattr('os.replace', failing_replace)
|
||||
|
||||
try:
|
||||
with pytest.raises(RuntimeError):
|
||||
store._write_entries(entries)
|
||||
assert False, "Should have raised"
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
# Temp file should be cleaned up
|
||||
assert not tmp_path_obj.exists()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user