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 pull request introduces unit tests for the market data processing system. Key components covered in the tests include:
StockApiClient Tests:
StockApiClient
with valid API keys.get_stocks
method to ensure it retrieves stock symbols correctly.CryptoApiClient Tests:
CryptoApiClient
with a valid API key.get_data
method to ensure it retrieves cryptocurrency data accurately.Storage Tests:
connect
method to ensure successful database connections.close
method for proper closure of database connections.store_data
method for correct insertion of data into the database.MarketDataEngine Tests:
process_stock_data
method to ensure correct orchestration of stock data processing.process_crypto_data
method for proper orchestration of cryptocurrency data processing.Mocking and Exception Handling:
unittest.mock
library to simulate API responses and log messages.Test Coverage and Execution:
These unit tests aim to improve the reliability and maintainability of the market data processing system by validating key functionalities and handling edge cases. The PR provides a foundation for ongoing development and refactoring efforts.
Additionally, this PR includes tests for the DAGs that validate the existence, loading, scheduling intervals and functions called by each task, ensuring their proper configuration and execution.
This PR introduces several tools to improve code quality and consistency. In addition to pre-commit hooks for running unit tests, the .pre-commit-config.yaml file also includes a hook for the Black code formatter. Black is an automatic code formatter that makes your Python code more readable and compliant with PEP 8, the Python style guide.
Developers can set up these pre-commit hooks by following the instructions provided in the README.md file. These hooks ensure that all committed code is properly formatted and that all unit tests pass, preventing code changes that may break existing functionality.
Furthermore, this PR also introduces a GitHub Actions workflow that runs unit tests and the Black formatter every time a pull request is made. This ensures that all proposed changes are properly tested and formatted before they can be merged into the main codebase.