Commit Graph

37 Commits (ca55986057ce0eaa0a5bff5ec6f16b3cd5b453c0)

Author SHA1 Message Date
epenet 18f30d2ee9
Fix pointless-string-statement pylint warning in emulated_hue tests (#119368) 2024-06-11 11:57:54 +02:00
Marc Mueller 279483ddb0
Import Generator from typing_extensions (2) (#118989) 2024-06-06 17:24:22 +02:00
epenet 461ac1e0bc
Add ClientSessionGenerator type hints in tests (#118377) 2024-05-29 14:49:14 +02:00
epenet a59621bf9e
Add more type hints to pylint plugin (#118319) 2024-05-28 18:37:38 +02:00
Sid 2cc916db6d
Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
Marc Mueller 38adfbf1a3
Add empty line after module docstring [tests a-e] (#112708) 2024-03-08 08:50:25 -05:00
epenet 728f62b1ec
Add type hints to integration tests (part 5) (#87850) 2023-02-12 19:39:48 +01:00
epenet 4142f0d15d
Add return type to tests without arguments (#87613)
* Add return type to tests without arguments

* Black

* Cancel fixture amends
2023-02-07 14:20:06 +01:00
Joakim Plate c576a68d33
Upgrade pytest-aiohttp (#82475)
* Upgrade pytest-aiohttp

* Make sure executors, tasks and timers are closed

Some test will trigger warnings on garbage collect, these warnings
spills over into next test.

Some test trigger tasks that raise errors on shutdown, these spill
over into next test.

This is to mimic older pytest-aiohttp and it's behaviour on test
cleanup.

Discussions on similar changes for pytest-aiohttp are here:
https://github.com/pytest-dev/pytest-asyncio/pull/309

* Replace loop with event_loop

* Make sure time is frozen for tests

* Make sure the ConditionType is not async

  /home-assistant/homeassistant/helpers/template.py:2082: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    def wrapper(*args, **kwargs):
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

* Increase litejet press tests with a factor 10

The times are simulated anyway, and we can't stop the normal
event from occuring.

* Use async handlers for aiohttp

tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
  /Users/joakim/src/hass/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_urldispatcher.py:189: DeprecationWarning: Bare functions are deprecated, use async ones
    warnings.warn(

* Switch to freezegun in modbus tests

The tests allowed clock to tick in between steps

* Make sure skybell object are fully mocked

Old tests would trigger attempts to post to could services:

```
DEBUG:aioskybell:HTTP post https://cloud.myskybell.com/api/v3/login/ Request with headers: {'content-type': 'application/json', 'accept': '*/*', 'x-skybell-app-id': 'd2b542c7-a7e4-4e1e-b77d-2b76911c7c46', 'x-skybell-client-id': '1f36a3c0-6dee-4997-a6db-4e1c67338e57'}
```

* Fix sorting that broke after rebase
2022-11-29 22:36:36 +01:00
Marc Mueller 62a5854e40
Fix bare except (#72906) 2022-06-02 13:58:04 +02:00
J. Nick Koston 1c334605b6
Enable strict typing to emulated_hue (#72676)
* Add typing to emulated_hue part 2

* cleanups

* adjust targets in test
2022-05-30 08:49:37 +02:00
J. Nick Koston 237ef6419b
Add basic typing to emulated_hue (#72663)
* Add basic typing to emulated_hue

* type a few more places

* fixes

* numbers are always stringified

* numbers are always stringified

* coverage

* drop assert
2022-05-29 18:27:32 +02:00
Ville Skyttä 8bc1509afa
Use HTTPStatus instead of HTTP_ consts and magic values in comp.../[de]* (#57990) 2021-10-22 16:28:56 +02:00
Erik Montnemery f6682ba99d
Block tests from opening sockets (#55516) 2021-10-05 14:46:09 -10:00
Erik Montnemery 05abf1405d
Migrate emulated_hue tests from unittest to pytest (#55794)
* Migrate emulated_hue tests from unittest to pytest

* Remove unused variables
2021-09-06 13:24:00 +02:00
springstan 6a7caad8dc
Use content type json constant (#40312) 2020-09-23 20:21:55 +02:00
J. Nick Koston 3cc099af80
Make emulated_hue upnp responder async (#39126) 2020-08-23 09:50:59 +02:00
Thomas Hollstegge ed62fe03b0
Fix emulated_hue compatibility with older devices (#36090)
* Fix emulated_hue compatibility with older devices

* Fix test ugliness

* Fix pylint errors
2020-05-25 14:55:23 -05:00
Thomas Hollstegge c5379a0f35
Improve emulated_hue compatibility with newer systems (#35148)
* Make emulated hue detectable by Busch-Jaeger free@home SysAP

* Emulated hue: Remove unnecessary host line from UPnP response

* Test that external IPs are blocked for config route

* Add another test for unauthorized users

* Change hue username to nouser

nouser seems to be used by the official Hue Bridge v1 Android app and is
used by other projects as well

Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-04 00:18:33 -05:00
Thomas Hollstegge e4e89becc6
Return emulated hue id for update requests (#35139)
* Return emulated hue id for update requests

* Emulated Hue: Rename function argument to match its content

* Use HTTP status consts throughout the test

* Use HTTP status consts in UPnP test
2020-05-03 19:27:19 -05:00
Paulus Schoutsen 2af984917e
Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Franck Nijhof d7e9959442
String formatting improvements for tests (2) (#33666) 2020-04-05 00:33:07 +02:00
Paulus Schoutsen 5fdc60e067
Add Safe Mode (#30723)
* Store last working HTTP settings

* Add safe mode

* Fix tests

* Add cloud to safe mode

* Update logging text

* Fix camera tests leaving files behind

* Make emulated_hue tests not leave files behind

* Make logbook tests not leave files behind

* Make tts tests not leave files behind

* Make image_processing tests not leave files behind

* Make manual_mqtt tests not leave files behind
2020-01-14 13:03:02 -08:00
Ville Skyttä e6388e186c
Remove unnecessary string literal concatenations (#30360) 2020-01-02 21:17:10 +02:00
Bas Nijholt 27bd6ca1db Sort imports according to PEP8 for emulated_hue (#29667) 2019-12-09 12:12:41 +01:00
orrpan 9ba9b3339b Add full state view for emulated_hue (apps using emulated_hue, 'sleep cycle' and 'sleep as android') (#26650)
* Add full state view for emulated_hue

* clean and support updated sleep cycle

* emulated hue add reuasable logic and cleanup code

* emulated hue correct typos

* Update hue_api.py

* correct error message and update test_hue_api.py

* cleanup test_hue_api.py
2019-12-05 15:23:54 -08:00
Ville Skyttä d4c80f160c Add bandit, use to catch known vulnerable XML parsing (#28341)
* Add bandit to pre-commit and CI, use to catch known vulnerable XML parsing

* Use defusedxml instead of direct xml.etree to parse XML

* Move config to tests/bandit.yaml
2019-11-18 09:10:15 +01:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Adam Mills 5c3a4e3d10 Restore states through a JSON store instead of recorder (#17270)
* Restore states through a JSON store

* Accept entity_id directly in restore state helper

* Keep states stored between runs for a limited time

* Remove warning
2018-11-28 13:16:43 +01:00
Paulus Schoutsen 08fe7c3ece
Pytest tests (#17750)
* Convert core tests

* Convert component tests to use pytest assert

* Lint 🤷‍♂️

* Fix test

* Fix 3 typos in docs
2018-10-24 12:10:05 +02:00
Ville Skyttä dbd0763f83 Grammar and spelling fixes (#16065) 2018-08-19 22:29:08 +02:00
Ville Skyttä e31dd4404e Pylint 2 fixes (#15487)
* pylint 2 inline disable syntax fixes

* pylint 2 logging-not-lazy fixes

* pylint 2 consider-using-in fixes

* Revert pylint 2 inline disable syntax fixes addressing unused-imports

Will have a go at removing more unused imports altogether first.
2018-07-17 19:34:29 +02:00
Matthias Urlichs f5cc40024d Rename homeassistant.util.async to .async_ (#13088)
"async" is (going to be) a reserved word.
2018-03-11 10:01:12 -07:00
Ville Skyttä 78a3c01f27 Flake8 35 (#11972)
* Upgrade flake8 to 3.5

* Fix flake8 bare except errors

* Make flake8 and pylint cooperate
2018-01-29 00:23:53 -08:00
Fabian Affolter de9d19d6f4 Use constants for HTTP headers (#10313)
* Use constants for HTTP headers

* Fix ordering

* Move 'no-cache' to platform
2017-11-04 12:04:05 -07:00
Paulus Schoutsen 2650c73a89 Split bootstrap into bs + setup (#6416)
* Split bootstrap into bs + setup

* Lint
2017-03-05 10:41:54 +01:00
Paulus Schoutsen a9be6c36f1 Re-org emulated_hue and fix google home (#4708) 2016-12-04 10:57:48 -08:00