test(hip-3-pusher): add comprehensive unit tests for price state, listeners, and publisher#3422
Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Open
test(hip-3-pusher): add comprehensive unit tests for price state, listeners, and publisher#3422devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Conversation
…teners, and publisher - Extended test_price_state.py with 63 new tests covering: - PriceUpdate dataclass (time_diff, session_flag, price types) - PriceSourceState class (init, put/get, repr) - ConstantSourceConfig handling - OracleMidAverageConfig with various scenarios - PairSourceConfig edge cases (zero quote, missing sources) - Exponent scaling for Lazer/Hermes prices - UseSessionFlag behavior - External prices, multiple symbols, unknown sources - HL mark state handling - Added test_listeners.py with 17 tests covering: - HermesListener message parsing - LazerListener message parsing and auth headers - HyperliquidListener parsing for asset context and mids - Added test_publisher.py with 17 tests covering: - construct_mark_pxs utility method - _get_error_reason error classification - PushErrorReason enum validation Co-Authored-By: Mike Rolish <merolish@mit.edu>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Mike Rolish <merolish@mit.edu>
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
Adds comprehensive unit test coverage for the hip-3-pusher application, expanding from 12 tests to 75 tests across three test files.
Changes:
test_price_state.pywith tests for PriceUpdate, PriceSourceState, ConstantSourceConfig, OracleMidAverageConfig, PairSourceConfig, exponent scaling, session flags, and waterfall fallback behaviortest_listeners.pywith tests for HermesListener, LazerListener, and HyperliquidListener message parsingtest_publisher.pywith tests forconstruct_mark_pxs()and_get_error_reason()utilitiesRationale
The existing test coverage was limited to basic waterfall scenarios and session EMA behavior. This PR improves coverage of edge cases including malformed messages, missing data sources, stale price handling, and error classification.
How has this been tested?
All 75 tests pass locally with
pytest tests/ -v. CI checks pass includingruff format,ruff check,mypy, andpytest.Updates since last revision
ruff formattotest_price_state.pyto fix CI formatting check failureHuman Review Checklist
noqa: RUF012comments for mutable class attributes in mock configs are acceptable for test codeLink to Devin run: https://app.devin.ai/sessions/7995cdd3ff1448e3866d32aa5af2d263
Requested by: Mike Rolish (@merolish)