[codex] Isolate apps review validation imports#7943
Open
tianmind-studio wants to merge 1 commit into
Open
Conversation
Temporarily stub python_multipart while importing the apps router in the review-reply validation test. Restore pre-existing stubbed modules after import so this test does not remove stubs installed by other unit tests during collection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
python_multipartwhile importingrouters.appsintest_apps_review_reply_validation.pyso the test can collect in lightweight Windows backend environments without the full multipart package installed.sys.modulesentries globally.reply_to_reviewvalidation while avoiding cross-test collection pollution.Root cause
routers.appsdefinesForm/Fileendpoints at import time. FastAPI validates thatpython-multipartis installed while building those routes, so this lightweight Windows backend venv failed before the review-reply assertions could collect:After fixing that collection issue, running this file with another stub-heavy test exposed an existing cleanup problem: the test removed stubs installed by other collected test modules. Restoring a snapshot keeps the import isolation local to this file.
Validation
python -m pytest backend/tests/unit/test_apps_review_reply_validation.py --collect-only -q --tb=short-> 4 tests collectedpython -m pytest backend/tests/unit/test_apps_review_reply_validation.py -q --tb=short-> 4 passedpython -m pytest backend/tests/unit/test_action_item_date_validation.py backend/tests/unit/test_apps_review_reply_validation.py -q --tb=short-> 30 passedpython -m pytest backend/tests/unit/test_apps_review_reply_validation.py backend/tests/unit/test_action_item_date_validation.py -q --tb=short-> 30 passedblack --line-length 120 --skip-string-normalization backend/tests/unit/test_apps_review_reply_validation.pypython -m py_compile backend/tests/unit/test_apps_review_reply_validation.pygit diff --checkscripts/pre-commit