Skip to content

Add config flow to Meteo-France#29927

Merged
MartinHjelmare merged 17 commits into
home-assistant:devfrom
Quentame:meteo_france/config-flow
Feb 4, 2020
Merged

Add config flow to Meteo-France#29927
MartinHjelmare merged 17 commits into
home-assistant:devfrom
Quentame:meteo_france/config-flow

Conversation

@Quentame
Copy link
Copy Markdown
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
Copy Markdown

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 Quentame force-pushed the meteo_france/config-flow branch from 8d1b15d to 96a78be Compare December 16, 2019 21:45
@Quentame Quentame force-pushed the meteo_france/config-flow branch from 96a78be to 28f3f9d Compare December 21, 2019 21:21
@Quentame Quentame force-pushed the meteo_france/config-flow branch 3 times, most recently from e1daff0 to ed718c1 Compare January 8, 2020 12:58
@Quentame
Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
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 😊

Comment thread homeassistant/components/meteo_france/config_flow.py Outdated
Comment thread homeassistant/components/meteo_france/config_flow.py Outdated
Comment thread homeassistant/components/meteo_france/__init__.py Outdated
@Quentame
Copy link
Copy Markdown
Member Author

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

@springstan
Copy link
Copy Markdown
Member

Of course @Quentame, no problem at all.

Copy link
Copy Markdown
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 🎉

Comment thread homeassistant/components/meteo_france/__init__.py Outdated
Comment thread homeassistant/components/meteo_france/__init__.py Outdated
Comment thread homeassistant/components/meteo_france/config_flow.py Outdated
Comment thread homeassistant/components/meteo_france/config_flow.py Outdated
Comment thread homeassistant/components/meteo_france/sensor.py Outdated
Comment thread homeassistant/components/meteo_france/sensor.py Outdated
Comment thread homeassistant/components/meteo_france/sensor.py Outdated
Comment thread tests/components/meteo_france/test_config_flow.py Outdated
@Quentame Quentame force-pushed the meteo_france/config-flow branch from e1610df to bd7ffb4 Compare February 3, 2020 14:39
Comment thread homeassistant/components/meteo_france/config_flow.py Outdated
Comment thread homeassistant/components/meteo_france/sensor.py Outdated
Comment thread homeassistant/components/meteo_france/__init__.py Outdated
Comment thread homeassistant/components/meteo_france/__init__.py Outdated
update=False,
) as service_mock:
service_mock.return_value.get_data.return_value = {"name": CITY_2_NAME}
yield service_mock
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

Quentame commented Feb 3, 2020

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

Copy link
Copy Markdown
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.

Comment thread homeassistant/components/meteo_france/__init__.py
Comment thread homeassistant/components/meteo_france/manifest.json
Comment thread homeassistant/components/meteo_france/weather.py
Comment thread tests/components/meteo_france/test_config_flow.py Outdated
@Quentame
Copy link
Copy Markdown
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
Copy Markdown

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.

Comment thread homeassistant/components/meteo_france/strings.json Outdated
Copy link
Copy Markdown
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!

@MartinHjelmare MartinHjelmare merged commit 201ea25 into home-assistant:dev 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

None yet

Development

Successfully merging this pull request may close these issues.

5 participants