Test that notes persist across tool instances.
()
| 85 | |
| 86 | @pytest.mark.asyncio |
| 87 | async def test_note_persistence(): |
| 88 | """Test that notes persist across tool instances.""" |
| 89 | print("\n=== Testing Note Persistence ===") |
| 90 | |
| 91 | with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".json") as f: |
| 92 | note_file = f.name |
| 93 | |
| 94 | try: |
| 95 | # First instance - record note |
| 96 | record_tool1 = SessionNoteTool(memory_file=note_file) |
| 97 | result = await record_tool1.execute( |
| 98 | content="Important fact to remember", |
| 99 | category="test", |
| 100 | ) |
| 101 | assert result.success |
| 102 | |
| 103 | # Second instance - recall note (simulates new session) |
| 104 | recall_tool2 = RecallNoteTool(memory_file=note_file) |
| 105 | result = await recall_tool2.execute() |
| 106 | assert result.success |
| 107 | assert "Important fact to remember" in result.content |
| 108 | print(f"Persisted note: {result.content}") |
| 109 | |
| 110 | print("✅ Note persistence test passed") |
| 111 | |
| 112 | finally: |
| 113 | Path(note_file).unlink(missing_ok=True) |
| 114 | |
| 115 | |
| 116 | async def main(): |
no test coverage detected