Skip to content
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

Merged
merged 4 commits into from
Jul 10, 2019
Merged

Add check_config helper #24557

merged 4 commits into from
Jul 10, 2019

Conversation

kellerza
Copy link
Member

Description:

check_ha_config_file, used by the core moved out of scripts/check_config as discussed in #13017

If helpers/check_config is ok, I'll move the applicable tests

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with lazytox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If the code does not interact with devices:

  • Move tests

@balloob
Copy link
Member

balloob commented Jun 17, 2019

looks good.

@kellerza
Copy link
Member Author

I really did do most of the work in a previous PR, this is just moving things around ;-)

Are you ok with the filename helpers/check_config? then I'll start moving tests

@balloob
Copy link
Member

balloob commented Jun 17, 2019

yeah that's fine .

@balloob
Copy link
Member

balloob commented Jul 1, 2019

@kellerza any work left on this or can we merge it ?

@MartinHjelmare MartinHjelmare changed the title check_config Add check_config helper Jul 1, 2019
@@ -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
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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

Copy link
Member Author

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

@kellerza
Copy link
Member Author

kellerza commented Jul 2, 2019

I started adding tests, but its a bit slow going. Let me commit that and then we can merge

@pvizeli
Copy link
Member

pvizeli commented Jul 4, 2019

it should exist a tests/helpers/test_config_check.py

Ready to commit after comments are addressed 👍

@balloob
Copy link
Member

balloob commented Jul 8, 2019

We need tests for the helper inside tests/helpers/test_check_config.py

@kellerza
Copy link
Member Author

kellerza commented Jul 9, 2019

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 scripts

@kellerza
Copy link
Member Author

kellerza commented Jul 9, 2019

Should be good to go now.

@balloob balloob merged commit 2e26f0b into home-assistant:dev Jul 10, 2019
@balloob
Copy link
Member

balloob commented Jul 10, 2019

Awesome!

@kellerza kellerza deleted the config_helper branch July 10, 2019 19:08
@balloob balloob mentioned this pull request Jul 17, 2019
alandtse pushed a commit to alandtse/home-assistant that referenced this pull request Oct 12, 2019
* check_config

* no ignore

* tests

* try tests again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants