core/tests
Miguel Camba 5175737b60
Add Valve integration (#102184)
* Add Valve integration.

This adds the valve integration discussed in https://github.com/home-assistant/architecture/discussions/975
Most of the code is taken from the cover integration but simplified since valves
can't tilt.

There are a couple outstanding errors I'm not sure how to solve and prevents
me from even making this commit without `--no-verify`.

* Apply PR feedback

* Apply more feedback: Intruduce the bare minimum

* Remove file commited by mistake

* Hopefully this fixes tests

* Match cover's typing and mypy settings

* Change some configuration files

* Fix test

* Increase code coverage a little

* Code coverate inproved to 91%

* 95% code coverage

* Coverate up to 97%

* Coverage 98%

* Apply PR feedback

* Even more feedback

* Add line I shouldn't have removed

* Derive closed/open state from current position

* Hopefully last feedback

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove unnecesary translation

* Remove unused method arguments

* Complete code coverage

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Simplify tests

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Apply last feedback

* Update tests/components/valve/test_init.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/valve/test_init.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/testing_config/custom_components/test/valve.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* More feedback

* Apply suggestion

* And more feedback

* Apply feedback

* Remove commented code

* Reverse logic to unindent

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Implement stop valve for Mock valve

* Fix tests now that I've implemented stop_valve

* Assert it's neither opening nor closing

* Use current position instead

* Avoid scheduling executor when opening or closing

* Fix incorrect bitwise operation

* Simplify toggle

* Remove uneeded partial functions

* Make is_last_toggle_direction_open private

* Remove valve from test custom integration

* Improve test coverage

* Address review comments

* Address review comments

* Address review comments

* Update homeassistant/components/valve/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Erik <erik@montnemery.com>
2023-12-18 19:48:00 +01:00
..
auth Migrate auth tests to use freezegun (#105243) 2023-12-07 21:18:10 +01:00
components Add Valve integration (#102184) 2023-12-18 19:48:00 +01:00
fixtures Add domain key config validation (#104242) 2023-12-05 15:07:32 +01:00
hassfest
helpers Allow step size any for number selector in slider mode (#105978) 2023-12-18 15:30:59 +01:00
pylint
resources
scripts Use modern platform path when reporting platform config errors (#104238) 2023-12-05 15:06:13 +01:00
snapshots Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
test_util Extend `auth/providers` endpoint and add `/api/person/list` endpoint for local ip requests (#103906) 2023-11-24 17:11:54 +01:00
testing_config Use ServiceValidationError for invalid fan preset_mode and move check to fan entity component (#104560) 2023-11-29 13:56:51 +01:00
util Reduce overhead to connect dispatcher (#105715) 2023-12-16 10:16:58 +01:00
__init__.py
common.py Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
conftest.py Remove HaAsyncServiceBrowser from zeroconf (#105881) 2023-12-18 14:11:06 +01:00
ignore_uncaught_exceptions.py
patch_time.py
ruff.toml
syrupy.py
test_bootstrap.py Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
test_config.py Add domain key config validation (#104242) 2023-12-05 15:07:32 +01:00
test_config_entries.py Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
test_core.py Migrate non-component tests to use freezegun/freezer (#105142) 2023-12-07 22:58:09 +01:00
test_data_entry_flow.py
test_exceptions.py
test_loader.py Rename safe mode to recovery mode (#102580) 2023-10-23 20:33:08 +02:00
test_main.py
test_requirements.py Switch formatting from black to ruff-format (#102893) 2023-11-27 14:38:59 +01:00
test_runner.py Trigger Home Assistant shutdown automations right before the stop event instead of during it (#91165) 2023-12-05 11:24:41 -10:00
test_setup.py Reverse component path (#104087) 2023-12-05 08:43:58 +01:00
test_test_fixtures.py Patch aiohttp server app router freeze in tests (#105555) 2023-12-12 14:40:38 +01:00
typing.py