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 config flow to Meteo-France #29927

Merged
merged 17 commits into from
Feb 4, 2020

Conversation

Quentame
Copy link
Member

@Quentame Quentame commented Dec 13, 2019

Breaking Change:

No more monitored_conditions, all sensors will be added --> ADR-03

Description:

Adding config flow to Météo-France

Pull request with documentation for home-assistant.io : home-assistant/home-assistant.io#11474

Checklist:

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

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@probot-home-assistant
Copy link

Hey there @victorcerutti, @oncleben31, mind taking a look at this pull request as its been labeled with a integration (meteo_france) you are listed as a codeowner for? Thanks!

@Quentame
Copy link
Member Author

@springstan if you have a little time, I will appreciated a review, and why not an approval 😉

Dev automation moved this from Needs review to Review in progress Jan 11, 2020
Copy link
Member

@springstan springstan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Quentame I have found some time to look over your code, please see my review comments for more information 😊

homeassistant/components/meteo_france/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/meteo_france/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/meteo_france/__init__.py Outdated Show resolved Hide resolved
@Quentame
Copy link
Member Author

Thanks a lot for taking your time on my PR and for your review @springstan

@springstan
Copy link
Member

Of course @Quentame, no problem at all.

Copy link
Member

@springstan springstan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

Dev automation moved this from Review in progress to Reviewer approved Jan 11, 2020
homeassistant/components/meteo_france/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/meteo_france/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/meteo_france/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/meteo_france/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/meteo_france/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/meteo_france/sensor.py Outdated Show resolved Hide resolved
homeassistant/components/meteo_france/sensor.py Outdated Show resolved Hide resolved
Dev automation moved this from Reviewer approved to Review in progress Feb 2, 2020
update=False,
) as service_mock:
service_mock.return_value.get_data.return_value = {"name": CITY_2_NAME}
yield service_mock
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartinHjelmare Is it possible to make conditional tests with MagicMock ?

That would be like :

if service_mock.return_value.postal_code == CITY_1_POSTAL:
    service_mock.return_value.get_data.return_value = {"name": CITY_1_NAME}
else if service_mock.return_value.postal_code == CITY_2_POSTAL:
    service_mock.return_value.get_data.return_value = {"name": CITY_2_NAME}

Looked but can't find.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on what the attributes on the mock return. By default they return mocks, so they need to be set or specced by something.

@MartinHjelmare
Copy link
Member

Make sure to update the breaking change paragraph.

Ping me when that is done and the tests are ready and I'll have a final look.

@Quentame
Copy link
Member Author

Quentame commented Feb 3, 2020

@MartinHjelmare Documentation updated + breaking change paragraph updated + tests passing 😊

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just some small comments.

@Quentame
Copy link
Member Author

Quentame commented Feb 4, 2020

Tested with import :

meteo_france:
  - city: Paris
  - city: '75001'
  - city: '75004'
  - city: '75009'
  - city: Lyon
  - city: '69001'
  - city: '69004'
  - city: '69009'
  - city: '74220'

And needed a little more fix.

@codecov
Copy link

codecov bot commented Feb 4, 2020

Codecov Report

Merging #29927 into dev will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##              dev   #29927    +/-   ##
========================================
  Coverage   94.62%   94.62%            
========================================
  Files         749      750     +1     
  Lines       54193    54313   +120     
========================================
+ Hits        51278    51393   +115     
- Misses       2915     2920     +5     
Impacted Files Coverage Δ
homeassistant/components/samsungtv/config_flow.py 98.19% <0.00%> (-0.80%) ⬇️
homeassistant/components/alexa/capabilities.py 93.37% <0.00%> (-0.19%) ⬇️
homeassistant/components/template/light.py 97.69% <0.00%> (-0.16%) ⬇️
...meassistant/components/meteo_france/config_flow.py 100.00% <0.00%> (ø)
homeassistant/components/alexa/entities.py 98.50% <0.00%> (+<0.01%) ⬆️
homeassistant/components/samsungtv/media_player.py 96.57% <0.00%> (+0.14%) ⬆️
homeassistant/components/homematicip_cloud/hap.py 84.76% <0.00%> (+0.41%) ⬆️
homeassistant/components/derivative/sensor.py 88.63% <0.00%> (+1.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45c997e...90c63f9. Read the comment docs.

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Dev automation moved this from Review in progress to Reviewer approved Feb 4, 2020
@MartinHjelmare MartinHjelmare merged commit 201ea25 into home-assistant:dev Feb 4, 2020
Dev automation moved this from Reviewer approved to Done Feb 4, 2020
@Quentame Quentame deleted the meteo_france/config-flow branch February 4, 2020 21:44
@lock lock bot locked and limited conversation to collaborators Feb 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants