-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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
Add check_config helper #24557
Add check_config helper #24557
Conversation
looks good. |
I really did do most of the work in a previous PR, this is just moving things around ;-) Are you ok with the filename |
yeah that's fine . |
@kellerza any work left on this or can we merge it ? |
@@ -741,13 +741,13 @@ def config_without_domain(config: Dict, domain: str) -> Dict: | |||
|
|||
This method is a coroutine. | |||
""" | |||
from homeassistant.scripts.check_config import check_ha_config_file | |||
import homeassistant.helpers.check_config as check_config |
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.
Why do we import inside the function? Can we move the import to the top of the module?
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.
Initially we did that because it would pull in all the script stuff, and we didn't want that. Now that it's a helper we can just import at the top.
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.
The helper imports config an config imports the helper. Next PR I could try change this in config&web view
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.
Put the import on top of this file
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.
Not sure I can do that, because of the circular import.
If I move it to the top here, I have to move a whole list of imports into a function in the helper
Better to refactor/remove this method from config.py in the long run
I started adding tests, but its a bit slow going. Let me commit that and then we can merge |
it should exist a Ready to commit after comments are addressed 👍 |
We need tests for the helper inside |
That's embarrassing, seems it's not in the commit and can't find this file now. Luckily I only migrated the first three tests from |
Should be good to go now. |
Awesome! |
* check_config * no ignore * tests * try tests again
Description:
check_ha_config_file, used by the core moved out of
scripts/check_config
as discussed in #13017If
helpers/check_config
is ok, I'll move the applicable testsChecklist:
lazytox
. Your PR cannot be merged unless tests passIf the code does not interact with devices: