-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📌 Pull Request: Refactor & Enhance dbus-opendtu #227
Merged
Merged
Conversation
This file contains 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
…er in test_register_service method
…er in test_register_service method
…d a 'sign of life' signal to all services
…tu.py and restart.sh
- Add .coveragerc file to control coverage.py and exclude certain directories from coverage analysis. - Add run_coverage.sh script to run unit tests with coverage and generate coverage report.
Move functions to helpers instead of constants, add unit tests, and improve function to handle cases where there are no inverters or templates to query. Also, remove the dependency on running tests within the main function.
- Removed unreachable code in the _read_config_dtu method. - Clarified the logic for reading the DTU variant and other configuration values. - Ensured that the DTU variant is either constants.DTUVARIANT_OPENDTU or constants.DTUVARIANT_AHOY, raising an error otherwise. - Improved readability and maintainability of the code.
- Added a new test case to verify that the number of inverters is correctly set in the DbusService. - Configured the test with a specific DTU variant and number of inverters. - Used mocking to simulate the configuration and requests. - Included assertions to validate the expected behavior.
henne49
approved these changes
Dec 15, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to approve the code
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.
📌 Pull Request: Refactor & Enhance
dbus-opendtu
Hi Team! 👋
This pull request introduces a series of improvements and refactorings to the
dbus-opendtu
project. The main highlights include enhanced code readability, better testing coverage, and streamlined business logic. Here’s a detailed breakdown:✨ Main Changes:
🧪 Added Unit Tests:
requests.get
to simulate different responses for robust testing scenarios.🔄 Business Logic Updates:
🔧 Refactoring Highlights:
📂 Code Structure:
dbus-opendtu
for improved readability and maintainability.test_dbus-opendtu.py
by removing unused parameters and constants.🛠️ Code Simplification:
DbusService
constructor._
) instead of hyphens (-
)._get_serial
,_get_name
, and_get_status_url
methods for better encapsulation and readability.🚀 Enhancements:
📝 Test Coverage:
ahoy_0.5.93_live.json
to reflect new test configurations.🔍 Code Quality:
🙋♂️ Request for Support:
I could use your help to push the project towards 100% code coverage. It's a time-consuming task, so any support would be appreciated! If you can contribute by adding tests or enhancing existing ones, that would be fantastic. Let's aim for perfection together! 🚀
Thanks for reviewing! 😊 Feel free to comment or provide feedback.