Stabilize memories create source tests on Windows#7777
Conversation
Greptile SummaryFixes a Windows-only test failure caused by Python's
Confidence Score: 5/5Safe to merge — two-line change adds explicit UTF-8 encoding to file reads in tests with no production code touched. The change is isolated to a test helper file: two open() calls gain encoding='utf-8', which is the standard cross-platform fix for reading UTF-8 source files. No logic is altered, no assertions are changed, and the fix directly addresses the documented Windows failure mode. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[pytest collects test] --> B{Test class}
B --> C[TestMemoriesRateLimitWiring]
B --> D[TestCreateMemoryErrorHandling]
C --> E["_grep_router(pattern)\nopen(ROUTER_PATH, encoding='utf-8')"]
D --> F["_read_router()\nopen(ROUTER_PATH, encoding='utf-8')"]
E --> G[Iterate lines, re.search match]
F --> H[Return full source string]
G --> I[Assert count / content]
H --> I
Reviews (1): Last reviewed commit: "Stabilize memories create source tests o..." | Re-trigger Greptile |
Summary
routers/memories.pyas UTF-8 intest_memories_create.pyWindows reproduction
Before this change on Windows with the default GBK locale:
python -m pytest tests\unit\test_memories_create.py -q-> 13 failed, 9 passedUnicodeDecodeError: 'gbk' codec can't decode byte ...while readingrouters/memories.pyTesting
python -m pytest tests\unit\test_memories_create.py -q-> 22 passedpython -m black --line-length 120 --skip-string-normalization tests\unit\test_memories_create.py --checkpython -m py_compile tests\unit\test_memories_create.pygit diff --check