Stabilize delete-account tests stubs on Windows#7793
Conversation
Greptile SummaryThis PR makes two targeted changes to
Confidence Score: 4/5Safe to merge for The two changes to backend/tests/unit/test_delete_account_stripe_cancel.py — identical stub pattern without the Important Files Changed
|
|
The Greptile P1 summary was based on the earlier commit that only updated Addressed in the current head Validation from the PR body:
|
kodjima33
left a comment
There was a problem hiding this comment.
Test-only stabilization (backend/tests/unit), CI green
Summary
pytzin the auto-stubbed import prefixes for both delete-account tests that importrouters.users.sys.modulesentries from earlier tests cannot bypass the local_StubFinder.Why
test_delete_account_purge_storage.pyandtest_delete_account_stripe_cancel.pyboth importrouters.users, which has a broad import graph. In a lightweight Windows test environment, collection failed first on missingpytz. In broader collect-only runs, earlier tests can also leave staledatabase.*orutils.*entries insys.modules; because importlib returns existing modules before consulting these tests' finders, stale modules can break the router import before the deletion assertions run.This keeps both delete-account import sandboxes deterministic and scoped to the namespaces they already declare as stubbed.
Testing
python -m pytest tests\unit\test_delete_account_purge_storage.py -q-> 5 passedpython -m pytest tests\unit\test_delete_account_stripe_cancel.py -q-> 3 passedpython -m pytest tests\unit\test_delete_account_purge_storage.py tests\unit\test_delete_account_stripe_cancel.py -q-> 8 passedpython -m pytest tests\unit\test_byok_security.py tests\unit\test_delete_account_purge_storage.py tests\unit\test_delete_account_stripe_cancel.py --collect-only -q -x-> 89 tests collectedpython -m black --line-length 120 --skip-string-normalization tests\unit\test_delete_account_purge_storage.py tests\unit\test_delete_account_stripe_cancel.py --checkpython -m py_compile tests\unit\test_delete_account_purge_storage.py tests\unit\test_delete_account_stripe_cancel.pygit diff --check origin/main...HEAD