diff --git a/.bashrc b/.bashrc index 83cda4b9..a2a9a0dc 100644 --- a/.bashrc +++ b/.bashrc @@ -1,6 +1,4 @@ echo "Sourcing .bashrc" alias ll='ls -l' -export HA='/home/vscode/core' -cd $HA -source venv/bin/activate +# source venv/bin/activate diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1f06e7bb..b01c876f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,43 +1,54 @@ // See https://aka.ms/vscode-remote/devcontainer.json for format details. // "image": "ghcr.io/ludeeus/devcontainer/integration:latest", { - "image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.10", + "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye", "name": "Versatile Thermostat integration", - "context": "..", "appPort": [ "9123:8123" ], // "postCreateCommand": "container install", - "postCreateCommand": "./container install", - "extensions": [ - "ms-python.python", - "github.vscode-pull-request-github", - "ryanluker.vscode-coverage-gutters", - "ms-python.vscode-pylance" - ], + "postCreateCommand": "./container dev-setup", + "mounts": [ - "source=${localWorkspaceFolder}/.devcontainer/configuration.yaml,target=/home/vscode/core/config/configuration.yaml,type=bind,consistency=cached", - "source=${localWorkspaceFolder}/custom_components,target=/home/vscode/core/config/custom_components,type=bind,consistency=cached" + "source=/Users/jmcollin/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" ], - "settings": { - "files.eol": "\n", - "editor.tabSize": 4, - "terminal.integrated.profiles.linux": { - "Bash Profile": { - "path": "bash", - "args": [] + + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "github.vscode-pull-request-github", + "ryanluker.vscode-coverage-gutters", + "ms-python.vscode-pylance" + ], + // "mounts": [ + // "source=${localWorkspaceFolder}/.devcontainer/configuration.yaml,target=/home/vscode/core/config/configuration.yaml,type=bind,consistency=cached", + // "source=${localWorkspaceFolder}/custom_components,target=/home/vscode/core/config/custom_components,type=bind,consistency=cached" + // ], + "settings": { + "files.eol": "\n", + "editor.tabSize": 4, + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + "args": [] + } + }, + "terminal.integrated.defaultProfile.linux": "bash", + // "terminal.integrated.shell.linux": "/bin/bash", + "python.pythonPath": "/usr/bin/python3", + "python.analysis.autoSearchPaths": true, + "python.linting.pylintEnabled": true, + "python.linting.enabled": true, + "python.formatting.provider": "black", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true, + "python.experiments.optOutFrom": ["pythonTestAdapter"], + "python.analysis.logLevel": "Trace" } - }, - "terminal.integrated.defaultProfile.linux": "Bash Profile", - // "terminal.integrated.shell.linux": "/bin/bash", - "python.pythonPath": "/usr/bin/python3", - "python.analysis.autoSearchPaths": true, - "python.linting.pylintEnabled": true, - "python.linting.enabled": true, - "python.formatting.provider": "black", - "editor.formatOnPaste": false, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "files.trimTrailingWhitespace": true + } } } \ No newline at end of file diff --git a/.gitignore b/.gitignore index f2bb3d84..c4a90ad6 100644 --- a/.gitignore +++ b/.gitignore @@ -105,4 +105,6 @@ dist # init file required for unittest custom_components/__init__.py -__pycache__ \ No newline at end of file +__pycache__ + +config/** \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index c0e409ff..622909c3 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,36 +3,15 @@ "version": "0.2.0", "configurations": [ { - // Example of attaching to local debug server - "name": "Python: Attach Local", + "name": "Home Assistant (debug)", "type": "python", - "request": "attach", - "port": 5678, - "host": "localhost", + "request": "launch", + "module": "homeassistant", "justMyCode": false, - "pathMappings": [ - // { - // "localRoot": "${workspaceFolder}", - // "remoteRoot": "." - //}, - { - "localRoot": "${workspaceFolder}/../core", - "remoteRoot": "/home/vscode/core" - } - ] - }, - { - // Example of attaching to my production server - "name": "Python: Attach Remote", - "type": "python", - "request": "attach", - "port": 5678, - "host": "homeassistant.local", - "pathMappings": [ - { - "localRoot": "${workspaceFolder}", - "remoteRoot": "/usr/src/homeassistant" - } + "args": [ + "--debug", + "-c", + "config" ] } ] diff --git a/.vscode/settings.json b/.vscode/settings.json index 1107050c..5c3d5cfd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,12 +1,20 @@ { + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter" + }, "python.linting.pylintEnabled": true, "python.linting.enabled": true, - "python.pythonPath": "/usr/local/bin/python", "files.associations": { "*.yaml": "home-assistant" }, + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, "python.analysis.extraPaths": [ - "/home/vscode/core", - "/workspaces/versatile_thermostat" - ] + // "/home/vscode/core", + "/workspaces/custom_components/versatile_thermostat" + ], + "python.formatting.provider": "none" } \ No newline at end of file diff --git a/CONTRIBUTING-fr.md b/CONTRIBUTING-fr.md new file mode 100644 index 00000000..1dce83cc --- /dev/null +++ b/CONTRIBUTING-fr.md @@ -0,0 +1,61 @@ +# Consignes de contribution + +Contribuer à ce projet doit être aussi simple et transparent que possible, que ce soit : + +- Signaler un bug +- Discuter de l'état actuel du code +- Soumettre un correctif +- Proposer de nouvelles fonctionnalités + +## Github est utilisé pour tout + +Github est utilisé pour héberger du code, pour suivre les problèmes et les demandes de fonctionnalités, ainsi que pour accepter les demandes d'extraction. + +Les demandes d'extraction sont le meilleur moyen de proposer des modifications à la base de code. + +1. Fourchez le dépôt et créez votre branche à partir de `master`. +2. Si vous avez modifié quelque chose, mettez à jour la documentation. +3. Assurez-vous que votre code peluche (en utilisant du noir). +4. Testez votre contribution. +5. Émettez cette pull request ! + +## Toutes les contributions que vous ferez seront sous la licence logicielle MIT + +En bref, lorsque vous soumettez des modifications de code, vos soumissions sont considérées comme étant sous la même [licence MIT](http://choosealicense.com/licenses/mit/) qui couvre le projet. N'hésitez pas à contacter les mainteneurs si cela vous préoccupe. + +## Signaler les bogues en utilisant les [issues] de Github (../../issues) + +Les problèmes GitHub sont utilisés pour suivre les bogues publics. +Signalez un bogue en [ouvrant un nouveau problème](../../issues/new/choose) ; C'est si facile! + +## Rédiger des rapports de bogue avec des détails, un arrière-plan et un exemple de code + +Les **rapports de bogues géniaux** ont tendance à avoir : + +- Un résumé rapide et/ou un historique +- Étapes à reproduire + - Être spécifique! + - Donnez un exemple de code si vous le pouvez. +- Ce à quoi vous vous attendiez arriverait +- Que se passe-t-il réellement +- Notes (y compris éventuellement pourquoi vous pensez que cela pourrait se produire, ou des choses que vous avez essayées qui n'ont pas fonctionné) + +Les gens *adorent* les rapports de bogues approfondis. Je ne plaisante même pas. + +## Utilisez un style de codage cohérent + +Utilisez [black](https://github.com/ambv/black) pour vous assurer que le code suit le style. + +## Testez votre modification de code + +Ce composant personnalisé est basé sur les meilleures pratiques décrites ici [modèle d'intégration_blueprint](https://github.com/custom-components/integration_blueprint). + +Il est livré avec un environnement de développement dans un conteneur, facile à lancer +si vous utilisez Visual Studio Code. Avec ce conteneur, vous aurez un stand alone +Instance de Home Assistant en cours d'exécution et déjà configurée avec le inclus +[`.devcontainer/configuration.yaml`](./.devcontainer/configuration.yaml) +déposer. + +## Licence + +En contribuant, vous acceptez que vos contributions soient autorisées sous sa licence MIT. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..b9c9516e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,61 @@ +# Contribution guidelines + +Contributing to this project should be as easy and transparent as possible, whether it's: + +- Reporting a bug +- Discussing the current state of the code +- Submitting a fix +- Proposing new features + +## Github is used for everything + +Github is used to host code, to track issues and feature requests, as well as accept pull requests. + +Pull requests are the best way to propose changes to the codebase. + +1. Fork the repo and create your branch from `master`. +2. If you've changed something, update the documentation. +3. Make sure your code lints (using black). +4. Test you contribution. +5. Issue that pull request! + +## Any contributions you make will be under the MIT Software License + +In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. + +## Report bugs using Github's [issues](../../issues) + +GitHub issues are used to track public bugs. +Report a bug by [opening a new issue](../../issues/new/choose); it's that easy! + +## Write bug reports with detail, background, and sample code + +**Great Bug Reports** tend to have: + +- A quick summary and/or background +- Steps to reproduce + - Be specific! + - Give sample code if you can. +- What you expected would happen +- What actually happens +- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) + +People *love* thorough bug reports. I'm not even kidding. + +## Use a Consistent Coding Style + +Use [black](https://github.com/ambv/black) to make sure the code follows the style. + +## Test your code modification + +This custom component is based on best practices described here [integration_blueprint template](https://github.com/custom-components/integration_blueprint). + +It comes with development environment in a container, easy to launch +if you use Visual Studio Code. With this container you will have a stand alone +Home Assistant instance running and already configured with the included +[`.devcontainer/configuration.yaml`](./.devcontainer/configuration.yaml) +file. + +## License + +By contributing, you agree that your contributions will be licensed under its MIT License. \ No newline at end of file diff --git a/container b/container index 4fc92ea5..b6021885 100755 --- a/container +++ b/container @@ -4,15 +4,12 @@ . .bashrc -cd $HA - function get_dev() { - cd /workspaces/versatile_thermostat/custom_components/versatile_thermostat/ - pip install pytest pip install -r requirements_dev.txt pip install -r requirements_test.txt - sudo chown -R vscode: /home/vscode/core - cd - + if [ -d /home/vscode/core ]; then + sudo chown -R vscode: /home/vscode/core + fi } echo "arguments are: "$1 @@ -20,8 +17,7 @@ echo "arguments are: "$1 case $1 in start) echo "Running container start" - cd $HA - hass -c ./config --debug + ./scripts/starts_ha.sh ;; dev-setup) get_dev @@ -43,8 +39,8 @@ case $1 in restart) echo "Killing existing container" pkill hass - echo "Killing existing container" - cd $HA - hass -c ./config + echo "Restarting existing container" + pwd + ./scripts/starts_ha.sh ;; esac diff --git a/custom_components/versatile_thermostat/binary_sensor.py b/custom_components/versatile_thermostat/binary_sensor.py index 6874a45b..c86a23e7 100644 --- a/custom_components/versatile_thermostat/binary_sensor.py +++ b/custom_components/versatile_thermostat/binary_sensor.py @@ -54,7 +54,9 @@ async def async_setup_entry( class SecurityBinarySensor(VersatileThermostatBaseEntity, BinarySensorEntity): """Representation of a BinarySensor which exposes the security state""" - def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None: + def __init__( + self, hass: HomeAssistant, unique_id, name, entry_infos + ) -> None: # pylint: disable=unused-argument """Initialize the SecurityState Binary sensor""" super().__init__(hass, unique_id, entry_infos.get(CONF_NAME)) self._attr_name = "Security state" @@ -87,7 +89,9 @@ def icon(self) -> str | None: class OverpoweringBinarySensor(VersatileThermostatBaseEntity, BinarySensorEntity): """Representation of a BinarySensor which exposes the overpowering state""" - def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None: + def __init__( + self, hass: HomeAssistant, unique_id, name, entry_infos + ) -> None: # pylint: disable=unused-argument """Initialize the OverpoweringState Binary sensor""" super().__init__(hass, unique_id, entry_infos.get(CONF_NAME)) self._attr_name = "Overpowering state" @@ -120,7 +124,9 @@ def icon(self) -> str | None: class WindowBinarySensor(VersatileThermostatBaseEntity, BinarySensorEntity): """Representation of a BinarySensor which exposes the window state""" - def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None: + def __init__( + self, hass: HomeAssistant, unique_id, name, entry_infos + ) -> None: # pylint: disable=unused-argument """Initialize the WindowState Binary sensor""" super().__init__(hass, unique_id, entry_infos.get(CONF_NAME)) self._attr_name = "Window state" @@ -134,7 +140,10 @@ async def async_my_climate_changed(self, event: Event = None): old_state = self._attr_is_on # Issue 120 - only take defined presence value - if self.my_climate.window_state in [STATE_ON, STATE_OFF] or self.my_climate.window_auto_state in [STATE_ON, STATE_OFF]: + if self.my_climate.window_state in [ + STATE_ON, + STATE_OFF, + ] or self.my_climate.window_auto_state in [STATE_ON, STATE_OFF]: self._attr_is_on = ( self.my_climate.window_state == STATE_ON or self.my_climate.window_auto_state == STATE_ON @@ -161,7 +170,9 @@ def icon(self) -> str | None: class MotionBinarySensor(VersatileThermostatBaseEntity, BinarySensorEntity): """Representation of a BinarySensor which exposes the motion state""" - def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None: + def __init__( + self, hass: HomeAssistant, unique_id, name, entry_infos + ) -> None: # pylint: disable=unused-argument """Initialize the MotionState Binary sensor""" super().__init__(hass, unique_id, entry_infos.get(CONF_NAME)) self._attr_name = "Motion state" @@ -195,7 +206,9 @@ def icon(self) -> str | None: class PresenceBinarySensor(VersatileThermostatBaseEntity, BinarySensorEntity): """Representation of a BinarySensor which exposes the presence state""" - def __init__(self, hass: HomeAssistant, unique_id, name, entry_infos) -> None: + def __init__( + self, hass: HomeAssistant, unique_id, name, entry_infos + ) -> None: # pylint: disable=unused-argument """Initialize the PresenceState Binary sensor""" super().__init__(hass, unique_id, entry_infos.get(CONF_NAME)) self._attr_name = "Presence state" diff --git a/custom_components/versatile_thermostat/requirements_dev.txt b/requirements_dev.txt similarity index 100% rename from custom_components/versatile_thermostat/requirements_dev.txt rename to requirements_dev.txt diff --git a/custom_components/versatile_thermostat/requirements_test.txt b/requirements_test.txt similarity index 93% rename from custom_components/versatile_thermostat/requirements_test.txt rename to requirements_test.txt index 0d727750..398c1c7e 100644 --- a/custom_components/versatile_thermostat/requirements_test.txt +++ b/requirements_test.txt @@ -2,4 +2,5 @@ -r requirements_dev.txt aiodiscover ulid_transform +pytest-asyncio pytest-homeassistant-custom-component \ No newline at end of file diff --git a/scripts/starts_ha.sh b/scripts/starts_ha.sh new file mode 100755 index 00000000..3d70362d --- /dev/null +++ b/scripts/starts_ha.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e +set -x + +cd "$(dirname "$0")/.." +pwd + +# Create config dir if not present +if [[ ! -d "${PWD}/config" ]]; then + mkdir -p "${PWD}/config" + # Add defaults configuration + hass --config "${PWD}/config" --script ensure_config + # Overwrite configuration.yaml if provided + if [ -f ${PWD}/.devcontainer/configuration.yaml ]; then + rm -f ${PWD}/config/configuration.yaml + ln -s ${PWD}/.devcontainer/configuration.yaml ${PWD}/config/configuration.yaml + fi +fi + +# Set the path to custom_components +## This let's us have the structure we want /custom_components/integration_blueprint +## while at the same time have Home Assistant configuration inside /config +## without resulting to symlinks. +export PYTHONPATH="${PYTHONPATH}:${PWD}/custom_components" + +# Start Home Assistant +hass --config "${PWD}/config" --debug \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..c3b29162 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[tool:pytest] +testpaths = tests +asyncio_mode = auto \ No newline at end of file diff --git a/custom_components/versatile_thermostat/tests/__init__.py b/tests/__init__.py similarity index 100% rename from custom_components/versatile_thermostat/tests/__init__.py rename to tests/__init__.py diff --git a/custom_components/versatile_thermostat/tests/commons.py b/tests/commons.py similarity index 98% rename from custom_components/versatile_thermostat/tests/commons.py rename to tests/commons.py index 1380feae..13bcfed6 100644 --- a/custom_components/versatile_thermostat/tests/commons.py +++ b/tests/commons.py @@ -20,9 +20,9 @@ from pytest_homeassistant_custom_component.common import MockConfigEntry -from ..climate import VersatileThermostat -from ..const import * # pylint: disable=wildcard-import, unused-wildcard-import -from ..underlyings import * # pylint: disable=wildcard-import, unused-wildcard-import +from custom_components.versatile_thermostat.climate import VersatileThermostat +from custom_components.versatile_thermostat.const import * # pylint: disable=wildcard-import, unused-wildcard-import +from custom_components.versatile_thermostat.underlyings import * # pylint: disable=wildcard-import, unused-wildcard-import from .const import ( # pylint: disable=unused-import MOCK_TH_OVER_SWITCH_USER_CONFIG, diff --git a/custom_components/versatile_thermostat/tests/conftest.py b/tests/conftest.py similarity index 98% rename from custom_components/versatile_thermostat/tests/conftest.py rename to tests/conftest.py index 08ff58c0..2260dfd9 100644 --- a/custom_components/versatile_thermostat/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,6 @@ """Global fixtures for integration_blueprint integration.""" +# pylint: disable=line-too-long + # Fixtures allow you to replace functions with a Mock object. You can perform # many options via the Mock to reflect a particular behavior from the original # function that you want to see without going through the function's actual logic. @@ -34,7 +36,7 @@ # This fixture enables loading custom integrations in all tests. # Remove to enable selective use of this fixture @pytest.fixture(autouse=True) -def auto_enable_custom_integrations(enable_custom_integrations): +def auto_enable_custom_integrations(enable_custom_integrations): # pylint: disable=unused-argument """Enable all integration in tests""" yield diff --git a/custom_components/versatile_thermostat/tests/const.py b/tests/const.py similarity index 100% rename from custom_components/versatile_thermostat/tests/const.py rename to tests/const.py diff --git a/custom_components/versatile_thermostat/tests/test_binary_sensors.py b/tests/test_binary_sensors.py similarity index 99% rename from custom_components/versatile_thermostat/tests/test_binary_sensors.py rename to tests/test_binary_sensors.py index 70e59709..c9f8d53c 100644 --- a/custom_components/versatile_thermostat/tests/test_binary_sensors.py +++ b/tests/test_binary_sensors.py @@ -9,9 +9,8 @@ from pytest_homeassistant_custom_component.common import MockConfigEntry -from .commons import * # pylint: disable=wildcard-import, unused-wildcard-import -from ..climate import VersatileThermostat -from ..binary_sensor import ( +from custom_components.versatile_thermostat.climate import VersatileThermostat +from custom_components.versatile_thermostat.binary_sensor import ( SecurityBinarySensor, OverpoweringBinarySensor, WindowBinarySensor, @@ -29,7 +28,7 @@ async def test_security_binary_sensors( skip_hass_states_is_state, skip_turn_on_off_heater, skip_send_event, -): +): # pylint: disable=unused-argument """Test the security binary sensors in thermostat type""" entry = MockConfigEntry( diff --git a/custom_components/versatile_thermostat/tests/test_bugs.py b/tests/test_bugs.py similarity index 100% rename from custom_components/versatile_thermostat/tests/test_bugs.py rename to tests/test_bugs.py diff --git a/custom_components/versatile_thermostat/tests/test_config_flow.py b/tests/test_config_flow.py similarity index 98% rename from custom_components/versatile_thermostat/tests/test_config_flow.py rename to tests/test_config_flow.py index a7545ec8..1630c6a7 100644 --- a/custom_components/versatile_thermostat/tests/test_config_flow.py +++ b/tests/test_config_flow.py @@ -29,7 +29,7 @@ async def test_show_form(hass: HomeAssistant) -> None: @pytest.mark.parametrize("expected_lingering_tasks", [True]) @pytest.mark.parametrize("expected_lingering_timers", [True]) -async def test_user_config_flow_over_switch(hass: HomeAssistant, skip_hass_states_get): +async def test_user_config_flow_over_switch(hass: HomeAssistant, skip_hass_states_get): # pylint: disable=unused-argument """Test the config flow with all thermostat_over_switch features""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} @@ -128,7 +128,7 @@ async def test_user_config_flow_over_switch(hass: HomeAssistant, skip_hass_state @pytest.mark.parametrize("expected_lingering_tasks", [True]) @pytest.mark.parametrize("expected_lingering_timers", [True]) -async def test_user_config_flow_over_climate(hass: HomeAssistant, skip_hass_states_get): +async def test_user_config_flow_over_climate(hass: HomeAssistant, skip_hass_states_get): # pylint: disable=unused-argument """Test the config flow with all thermostat_over_climate features and no additional features""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} @@ -184,7 +184,7 @@ async def test_user_config_flow_over_climate(hass: HomeAssistant, skip_hass_stat @pytest.mark.parametrize("expected_lingering_tasks", [True]) @pytest.mark.parametrize("expected_lingering_timers", [True]) async def test_user_config_flow_window_auto_ok( - hass: HomeAssistant, skip_hass_states_get, skip_control_heating + hass: HomeAssistant, skip_hass_states_get, skip_control_heating # pylint: disable=unused-argument ): """Test the config flow with only window auto feature""" result = await hass.config_entries.flow.async_init( @@ -281,7 +281,7 @@ async def test_user_config_flow_window_auto_ok( @pytest.mark.parametrize("expected_lingering_tasks", [True]) @pytest.mark.parametrize("expected_lingering_timers", [True]) async def test_user_config_flow_window_auto_ko( - hass: HomeAssistant, skip_hass_states_get + hass: HomeAssistant, skip_hass_states_get # pylint: disable=unused-argument ): """Test the config flow with window auto and window features -> not allowed""" result = await hass.config_entries.flow.async_init( @@ -353,7 +353,7 @@ async def test_user_config_flow_window_auto_ko( @pytest.mark.parametrize("expected_lingering_tasks", [True]) @pytest.mark.parametrize("expected_lingering_timers", [True]) async def test_user_config_flow_over_4_switches( - hass: HomeAssistant, skip_hass_states_get, skip_control_heating + hass: HomeAssistant, skip_hass_states_get, skip_control_heating # pylint: disable=unused-argument ): """Test the config flow with 4 switchs thermostat_over_switch features""" diff --git a/custom_components/versatile_thermostat/tests/test_movement.py b/tests/test_movement.py similarity index 100% rename from custom_components/versatile_thermostat/tests/test_movement.py rename to tests/test_movement.py diff --git a/custom_components/versatile_thermostat/tests/test_multiple_switch.py b/tests/test_multiple_switch.py similarity index 100% rename from custom_components/versatile_thermostat/tests/test_multiple_switch.py rename to tests/test_multiple_switch.py diff --git a/custom_components/versatile_thermostat/tests/test_open_window_algo.py b/tests/test_open_window_algo.py similarity index 97% rename from custom_components/versatile_thermostat/tests/test_open_window_algo.py rename to tests/test_open_window_algo.py index 7d3c87cb..3834edab 100644 --- a/custom_components/versatile_thermostat/tests/test_open_window_algo.py +++ b/tests/test_open_window_algo.py @@ -2,7 +2,7 @@ from datetime import datetime, timedelta from .commons import * # pylint: disable=wildcard-import, unused-wildcard-import -from ..open_window_algorithm import WindowOpenDetectionAlgorithm +from custom_components.versatile_thermostat.open_window_algorithm import WindowOpenDetectionAlgorithm async def test_open_window_algo( diff --git a/custom_components/versatile_thermostat/tests/test_power.py b/tests/test_power.py similarity index 100% rename from custom_components/versatile_thermostat/tests/test_power.py rename to tests/test_power.py diff --git a/custom_components/versatile_thermostat/tests/test_security.py b/tests/test_security.py similarity index 100% rename from custom_components/versatile_thermostat/tests/test_security.py rename to tests/test_security.py diff --git a/custom_components/versatile_thermostat/tests/test_sensors.py b/tests/test_sensors.py similarity index 99% rename from custom_components/versatile_thermostat/tests/test_sensors.py rename to tests/test_sensors.py index 8755f91a..41b58b73 100644 --- a/custom_components/versatile_thermostat/tests/test_sensors.py +++ b/tests/test_sensors.py @@ -12,8 +12,8 @@ from pytest_homeassistant_custom_component.common import MockConfigEntry -from ..climate import VersatileThermostat -from ..sensor import ( +from custom_components.versatile_thermostat.climate import VersatileThermostat +from custom_components.versatile_thermostat.sensor import ( EnergySensor, MeanPowerSensor, OnPercentSensor, diff --git a/custom_components/versatile_thermostat/tests/test_start.py b/tests/test_start.py similarity index 99% rename from custom_components/versatile_thermostat/tests/test_start.py rename to tests/test_start.py index 3c11564a..450dac76 100644 --- a/custom_components/versatile_thermostat/tests/test_start.py +++ b/tests/test_start.py @@ -10,7 +10,7 @@ from pytest_homeassistant_custom_component.common import MockConfigEntry -from ..climate import VersatileThermostat +from custom_components.versatile_thermostat.climate import VersatileThermostat from .commons import * # pylint: disable=wildcard-import, unused-wildcard-import diff --git a/custom_components/versatile_thermostat/tests/test_tpi.py b/tests/test_tpi.py similarity index 94% rename from custom_components/versatile_thermostat/tests/test_tpi.py rename to tests/test_tpi.py index 7e73b5d9..b27b39ff 100644 --- a/custom_components/versatile_thermostat/tests/test_tpi.py +++ b/tests/test_tpi.py @@ -5,7 +5,9 @@ @pytest.mark.parametrize("expected_lingering_tasks", [True]) @pytest.mark.parametrize("expected_lingering_timers", [True]) -async def test_tpi_calculation(hass: HomeAssistant, skip_hass_states_is_state: None): +async def test_tpi_calculation( + hass: HomeAssistant, skip_hass_states_is_state: None +): # pylint: disable=unused-argument """Test the TPI calculation""" entry = MockConfigEntry( @@ -40,7 +42,7 @@ async def test_tpi_calculation(hass: HomeAssistant, skip_hass_states_is_state: N ) assert entity - tpi_algo = entity._prop_algorithm + tpi_algo = entity._prop_algorithm # pylint: disable=protected-access assert tpi_algo tpi_algo.calculate(15, 10, 7) diff --git a/custom_components/versatile_thermostat/tests/test_window.py b/tests/test_window.py similarity index 100% rename from custom_components/versatile_thermostat/tests/test_window.py rename to tests/test_window.py