feat: add backend unit testing foundation (Priority 1) - #7
Draft
chatlechat1994 wants to merge 1 commit into
Draft
Conversation
Owner
|
Thanks — this draft PR is exactly the right place to continue the work. Please feel free to keep building on this PR at your own pace without waiting for step-by-step approval from me on every small update. As long as the scope stays within the backend testing foundation / Priority 1 direction, you can continue iterating here. When you believe the PR is complete enough for final review, please mark it as Ready for review and I’ll review it then. Thanks again for taking this on. |
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.
This PR establishes the foundation for the project's unit testing suite, focusing on the critical initialization logic in backend/launcher.py and backend/data_server.py.
Coverage:
tests/backend/test_launcher.py: Added 5 unit tests covering appdata path resolution, configuration file generation, and error handling.
tests/backend/test_data_server.py: Added a verification test to ensure the FastAPI app object initializes correctly without triggering side effects.
Mocking & Isolation:
To ensure the test suite remains portable and runs locally without needing live broker accounts or specific system environments:
Used pytest.monkeypatch in test_launcher.py to isolate file system paths.
Used unittest.mock and sys.modules in test_data_server.py to stub out missing or system-dependent dependencies (like debug_subprocess and account_routes).
What is NOT covered yet:
Functional testing of live MT5 tick loops or WebSocket price broadcasting.
End-to-end integration testing of the authentication proxy.
Known Limitations:
Minor deprecation warnings regarding Pydantic V2 class-based config were observed but were not refactored to keep this PR scope strictly limited to testing infrastructure.