Stabilize neo grandfather source tests on Windows
Summary
- read
routers/payment.pyandutils/subscription.pyas UTF-8 intest_neo_desktop_grandfather.py - fix Windows non-UTF-8 locale failures in source-level Neo desktop grandfather tests
- keep the existing grandfather policy assertions unchanged
Windows reproduction
Before this change on Windows with the default GBK locale:
python -m pytest tests\unit\test_neo_desktop_grandfather.py -q-> 3 failed, 16 passed, 1 warning- failures were
UnicodeDecodeError: 'gbk' codec can't decode byte ...while readingrouters/payment.pyandutils/subscription.py
Testing
python -m pytest tests\unit\test_neo_desktop_grandfather.py -q-> 19 passed, 1 warningpython -m black --line-length 120 --skip-string-normalization tests\unit\test_neo_desktop_grandfather.py --checkpython -m py_compile tests\unit\test_neo_desktop_grandfather.pygit diff --check
Greptile Summary
Adds encoding='utf-8' to three open() calls in test_neo_desktop_grandfather.py that read routers/payment.py and utils/subscription.py as source text. Without this, Python falls back to the system locale encoding on Windows (e.g. GBK), causing UnicodeDecodeError on any non-ASCII bytes in those files.
- All three
open()calls that inspect source files now passencoding='utf-8'explicitly; test assertions are unchanged. - The fix is minimal and targeted — no other test logic or policy checks are affected.
Confidence Score: 5/5
Safe to merge — the change is a one-line encoding fix per call site with no logic impact.
All three open() calls that read Python source files as text now specify encoding='utf-8', which is the only change. Assertions are untouched and test coverage is unaffected. The fix is narrowly scoped to a real Windows locale bug and introduces no new risk.
No files require special attention.
Important Files Changed
| Filename | Overview |
|---|---|
| backend/tests/unit/test_neo_desktop_grandfather.py | Adds explicit encoding='utf-8' to three open() calls that read source files, fixing UnicodeDecodeError on Windows with non-UTF-8 default locales (e.g. GBK). No logic changes. |
Sequence Diagram
sequenceDiagram
participant pytest
participant test_neo_desktop_grandfather.py
participant routers/payment.py
participant utils/subscription.py
pytest->>test_neo_desktop_grandfather.py: run tests
test_neo_desktop_grandfather.py->>routers/payment.py: "open(encoding='utf-8')"
routers/payment.py-->>test_neo_desktop_grandfather.py: source text (UTF-8)
test_neo_desktop_grandfather.py->>test_neo_desktop_grandfather.py: assert current_period_start present x2
test_neo_desktop_grandfather.py->>utils/subscription.py: "open(encoding='utf-8')"
utils/subscription.py-->>test_neo_desktop_grandfather.py: source text (UTF-8)
test_neo_desktop_grandfather.py->>test_neo_desktop_grandfather.py: assert reconcile + env-override strings present
test_neo_desktop_grandfather.py-->>pytest: 19 passed
Reviews (1): Last reviewed commit: "Stabilize neo grandfather source tests o..." | Re-trigger Greptile