Commit graph

36 commits

Author SHA1 Message Date
epenet
fa8f86b672
Improve type hints in smartthings tests () 2024-08-14 15:07:55 +02:00
epenet
3e9d25f81d
Add missing argument type hints to component tests () 2024-06-14 09:26:46 +02:00
J. Nick Koston
dbd3147c9b
Remove async_late_forward_entry_setups and instead implicitly hold the lock ()
* Refactor config entry forwards to implictly obtain the lock instead of explictly

This is a bit of a tradeoff to not need async_late_forward_entry_setups

The downside is we can no longer detect non-awaited plastform setups
as we will always implicitly obtain the lock instead of explictly.

Note, this PR is incomplete and is only for discussion purposes
at this point

* preen

* cover

* cover

* restore check for non-awaited platform setup

* cleanup

* fix missing word

* make non-awaited test safer
2024-06-12 21:06:11 -04:00
J. Nick Koston
ed0568c655
Ensure config entries are not unloaded while their platforms are setting up ()
* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* Report non-awaited/non-locked config entry platform forwards

Its currently possible for config entries to be reloaded while their platforms
are being forwarded if platform forwards are not awaited or done after the
config entry is setup since the lock will not be held in this case.

In https://developers.home-assistant.io/blog/2022/07/08/config_entry_forwards
we advised to await platform forwards to ensure this does not happen, however
for sleeping devices and late discovered devices, platform forwards may happen
later.

If config platform forwards are happening during setup, they should be awaited

If config entry platform forwards are not happening during setup, instead
async_late_forward_entry_setups should be used which will hold the lock to
prevent the config entry from being unloaded while its platforms are being
setup

* run with error on to find them

* cert_exp, hold lock

* cert_exp, hold lock

* shelly async_late_forward_entry_setups

* compact

* compact

* found another

* patch up mobileapp

* patch up hue tests

* patch up smartthings

* fix mqtt

* fix esphome

* zwave_js

* mqtt

* rework

* fixes

* fix mocking

* fix mocking

* do not call async_forward_entry_setup directly

* docstrings

* docstrings

* docstrings

* add comments

* doc strings

* fixed all in core, turn off strict

* coverage

* coverage

* missing

* coverage
2024-06-04 21:34:39 -04:00
epenet
f39dd40be1
Add type hints for hass_storage in test fixtures () 2024-06-03 10:20:57 +02:00
Sid
895f73d8e4
Enable Ruff A001 () 2024-04-21 23:25:27 +02:00
Sid
3efee10b95
Enable Ruff RUF013 () 2024-04-10 08:55:59 +02:00
Joost Lekkerkerker
6bb4e7d62c
Bump ruff to 0.3.4 ()
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Marc Mueller
32f3f46542
Add empty line after module docstring (2) [tests.components] () 2024-03-08 19:16:21 +01:00
Erik Montnemery
fcdfeb74c8
Adjust smartthings tests which create devices () 2023-08-10 18:26:20 +02:00
Franck Nijhof
3f7275a9c7
Give scenes last activated state () 2022-01-07 19:02:32 +01:00
Paulus Schoutsen
ee2c950716
Merge system options into pref properties ()
* Make system options future proof

* Update tests

* Add types
2021-06-01 22:34:31 +02:00
Franck Nijhof
c68b259bd3
Cleanup of unused connection_class logic ()
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
2021-04-29 23:12:58 +02:00
Ville Skyttä
dc880118a4
Lint suppression cleanups ()
* Unused pylint suppression cleanups

* Remove outdated pylint bug references

* Add flake8-noqa config and note to run it every now and then

* Add codes to noqa's

* Unused noqa cleanups
2021-03-02 09:02:04 +01:00
Franck Nijhof
65cf2fcb6f
Drop asynctest () 2021-01-01 22:31:56 +01:00
Paulus Schoutsen
5dac3883b0
Stub light profiles () 2020-10-23 16:28:21 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 () 2020-08-27 13:56:20 +02:00
Andrew Sayre
ae5c50c1b6
Bump pysmartthings to v0.7.2 () 2020-07-22 16:01:57 -07:00
Quentame
1855c91988
Use CONF_CLIENT_ID & CONF_CLIENT_SECRET from homeassistant.const ()
* Use CONF_CLIENT_ID & CONF_CLIENT_SECRET from homeassistant.const

* Fix pylint

* Use in tests

* Search for "client_id"

* Fix tests

* Fix test

* Fix test
2020-05-30 17:27:20 +02:00
Franck Nijhof
e56dd8ed50
Detect use of deprecated base_url ()
* Detect use of deprecated base_url

* Update get_url helper

* Update core migration

* Migrate all tests
2020-05-08 17:52:32 +02:00
Paulus Schoutsen
ec47216388
Use built-in test helpers on 3.8 () 2020-04-30 13:29:50 -07:00
springstan
dde93304d3
Improve string formatting v2 ()
* Improve string formatting v2

* Improve string formatting v3

* Address review comments
2020-04-04 23:09:34 +02:00
Ville Skyttä
130571c478 Remove no longer needed auth.util, use secrets instead () 2019-12-12 16:46:33 +01:00
Robert Svensson
a2589f56e1 Add system options to config entries ()
* Add system options to config entries

* For feedback

* Follow most of balloobs comments

* Fix balloobs comments

* Improvements

* Fix second round of Balloobs comments

* Fix third round

* Add system options to mock config entry

* Fix integration tests

* Fix the last failing tests

* Fix disabled string

* Fix failing disabled_by tests

* New tests

* Config entry WS API tests

* Fix comments
2019-08-17 21:34:11 -07:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
Andrew Sayre
20301ae888 Use MockConfigEntry () 2019-07-16 14:51:30 -07:00
Andrew Sayre
a31e49c857
Improve SmartThings test mocking ()
* Migrate to asynctest

* Simplify mock access

* Use mocks
2019-07-08 22:39:55 -04:00
Andrew Sayre
7db4eeaf7f
Move SmartThings imports to top ()
* Move imports to top

* use lib constants

* Add missing three_axis mapping
2019-06-30 22:29:21 -04:00
Andrew Sayre
c401f35a43 Add cloudhook support to SmartThings component ()
* Add support for Nabu Casa cloudhooks

* Added tests to cover cloudhook creation and removal

* Remove cloud dependency
2019-03-11 08:33:25 -04:00
Andrew Sayre
c5734eecc7 Update dependencies to receive data on webhook callbacks () 2019-03-08 21:20:07 -08:00
Andrew Sayre
3b9db88065 Add SmartThings Scene platform ()
* Add SmartThings Scene platform

* Fixed failing tests after rebase

* Update cover tests.
2019-02-26 13:12:24 -08:00
Andrew Sayre
8b38b82e73 Enhance SmartThings component subscription ()
* Move to config v2 to store SmartApp oauth keys

* Add migration functionality.

* Regenerate refresh token on periodic basis

* Fix regenerate and misc. optimizations

* Review feedback

* Subscription sync logic now performs a difference operation

* Removed config entry reloading.
2019-02-22 20:35:12 +01:00
Andrew Sayre
e8ed56ca52 Add SmartThings Climate platform ()
* Add SmartThings Climate platform

* Add SmartThings Climate platform
2019-02-12 08:11:36 +01:00
Andrew Sayre
706810bbce Add SmartThings Sensor platform ()
* Add Sensor platform and update pysmartthings 0.6.0

* Add tests for Sensor platform

* Redesigned capability subscription process

* Removed redundant Entity inheritance

* Updated per review feedback.
2019-02-07 21:51:17 -07:00
Andrew Sayre
38ea43b678 Add SmartThings button support via events ()
* Add event support for buttons

* binary_sensor test clean-up
2019-02-02 22:08:37 -08:00
Andrew Sayre
69ec7980ad Add SmartThings component and switch platform ()
* Added SmartThings component and switch platform

* Corrected comment typos.

* Embedded switch platform.

* Replaced custom view usage with webhook component.

* Replaced urls with tokens in strings.

* Fixed line length.

* Use generated webhook id instead of static one.

* Reuse core constant instead of defining again.

* Optimizations in anticipation of future platforms.

* Use async_generate_path instead of hard-coded path.

* Fixed line length.

* Updates per review feedback.

* Updates per latest review feedback.
2019-01-30 17:31:59 -08:00