Skip to content

Commit 9a87294

Browse files
fix: update warning message and increase Windows timestamp tolerance
- Remove obsolete --project flag reference from BASIC_MEMORY_PROJECT warning - Increase timestamp tolerance to 2s for Windows in test_sync_preserves_timestamps - Windows filesystem timing precision requires larger tolerance than Unix systems Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>
1 parent 98551cc commit 9a87294

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/basic_memory/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def get_project_config(project_name: Optional[str] = None) -> ProjectConfig:
310310
os_project_name = os.environ.get("BASIC_MEMORY_PROJECT", None)
311311
if os_project_name: # pragma: no cover
312312
logger.warning(
313-
f"BASIC_MEMORY_PROJECT is not supported anymore. Use the --project flag or set the default project in the config instead. Setting default project to {os_project_name}"
313+
f"BASIC_MEMORY_PROJECT is not supported anymore. Set the default project in the config instead. Setting default project to {os_project_name}"
314314
)
315315
actual_project_name = project_name
316316
# if the project_name is passed in, use it

tests/sync/test_sync_service.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Test general sync behavior."""
22

33
import asyncio
4+
import os
45
from datetime import datetime, timezone
56
from pathlib import Path
67
from textwrap import dedent
@@ -637,8 +638,10 @@ async def test_sync_preserves_timestamps(
637638
entity_created_epoch = file_entity.created_at.timestamp()
638639
entity_updated_epoch = file_entity.updated_at.timestamp()
639640

640-
assert abs(entity_created_epoch - file_stats.st_ctime) < 1
641-
assert abs(entity_updated_epoch - file_stats.st_mtime) < 1 # Allow 1s difference
641+
# Allow 2s difference on Windows due to filesystem timing precision
642+
tolerance = 2 if os.name == 'nt' else 1
643+
assert abs(entity_created_epoch - file_stats.st_ctime) < tolerance
644+
assert abs(entity_updated_epoch - file_stats.st_mtime) < tolerance # Allow tolerance difference
642645

643646

644647
@pytest.mark.asyncio

0 commit comments

Comments
 (0)