Skip to content

Commit

Permalink
ci(tests): update pyproject
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Jan 31, 2025
1 parent aeb5f9c commit 857512a
Show file tree
Hide file tree
Showing 21 changed files with 7 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ jobs:

- name: "Pytest"
run: |
${{needs.base.outputs.PY_PATH}}/bin/pytest --cov tests/ --disable-warnings -s
${{needs.base.outputs.PY_PATH}}/bin/pytest --cov --disable-warnings -s
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ quiet-level = 3

[tool.pytest.ini_options]
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]
asyncio_mode = "auto"

[tool.coverage.run]
source = ["tests"]

# pylint config stolen from Home Assistant
[tool.pylint.MAIN]
Expand Down
4 changes: 0 additions & 4 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@
from typing import Any
from unittest.mock import AsyncMock, Mock
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant
from custom_components.localtuya import TuyaCloudApi
from custom_components.localtuya import coordinator
from custom_components.localtuya import entity
from custom_components.localtuya.const import DOMAIN

custom_comp_path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(custom_comp_path)

HOST = "192.168.1.100"
DEVICE_NAME = "device"

Expand Down
1 change: 0 additions & 1 deletion tests/test_alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
DPS_STATUS = {"1": None}


@pytest.mark.asyncio
async def test_alarm_control_panel():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaAlarmControlPanel)
entities: list[LocalTuyaAlarmControlPanel] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_auto_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@
}


@pytest.mark.asyncio
async def test_auto_configure():

for k in PLATFORMS.values():
Expand Down
1 change: 0 additions & 1 deletion tests/test_binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
DPS_STATUS = {"1": "activated", "2": False}


@pytest.mark.asyncio
async def test_button():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaBinarySensor)
entities: list[LocalTuyaBinarySensor] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
DPS_STATUS = {"1": True, "2": False}


@pytest.mark.asyncio
async def test_button():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaButton)
entities: list[LocalTuyaButton] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
}


@pytest.mark.asyncio
async def test_climate():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaClimate)
entities: list[LocalTuyaClimate] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
DPS_STATUS = {"1": "stop", "2": 80, "3": 80}


@pytest.mark.asyncio
async def test_cover():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaCover)
entities: list[LocalTuyaCover] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
DEVICE3_5 = b"\x00\x00f\x99\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x00\x00\x00\xf0\x93\x07 \xd5\x92~\xcf\xf2\x91\x85S\xdc\x9f\x8dY=dS\x18\xca>\xae\xc2\xcf\xe7iV\xf2{\xc4!\xe7\xb8\x00i\x11K\x11j\x0e5\xed\x8c\xe7mO\x91c\xceAGS\x7f@\xd6\x12\n\xce\x92\xb4\x9a\xe5\xef\xf4\x8e\xdf\xd3\xe1\xda\rt\xf1\xee\x1b\x86z\xb28\x9a\x11\xebx\x9c\xe4\x9b\x19t6L\x13JZ7\xe7\xa6\x88\xb9\xa9\xcc\xf91\xdc\x8f\x1d%>\x13\x10M'\xeeG\x9e\xf7\xe5\xd6\xdeK1W\xe0\xa9\xf5\x8c\\\xa1\xd6<\x1e\x1ec\xfb\xc9 CV\x9d\xa3C@I\x1c\x15\xb4=6\xa0\xce\n+\xef\x1c\xc1\x96\xf1_\xc0Y2\xe2\xcd\xc4j\xa7H\xcf\xe1B\xe1\xed^\x98\xfe;\xf1P:!%\x82*\xc9\xf6\xbd\x17\x8e\xd9\xb5\xdf\xba\x19\x8d\x03\x9b\xfa\x00\x99s\xd6t\x0eD=&\xd8\xd1\xd7\x827\xec\xac\xf2\x19\x8a\xfe\x94\x1f\xd5\xe6\xe1a\xc1\xfb 1\xa8\xf4]vd\x18\xed\x86<\x11\x13\xde\x14\xf2\xba\x00\x00\x99f"


@pytest.mark.asyncio
async def test_dsicovery():
mock_callback = AsyncMock()
discovery = TuyaDiscovery(mock_callback)
Expand Down
1 change: 0 additions & 1 deletion tests/test_fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
DPS_STATUS = {"1": True, "2": "mid", "3": 4, "4": "reverse", "6": True}


@pytest.mark.asyncio
async def test_fan():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaFan)
entities: list[LocalTuyaFan] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
DPS_STATUS = {"1": True, "2": 34, "4": "drying", "16": 34}


@pytest.mark.asyncio
async def test_humidifier():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaHumidifier)
entities: list[LocalTuyaHumidifier] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
BLE_COLOR = "0319090087db1c"


@pytest.mark.asyncio
async def test_light():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaLight)
entities: list[LocalTuyaLight] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
DPS_STATUS = {"1": None, "2": "unlocked"}


@pytest.mark.asyncio
async def test_lock():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaLock)
entities: list[LocalTuyaLock] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
DPS_STATUS = {"1": 500}


@pytest.mark.asyncio
async def test_lock():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaNumber)
entities: list[LocalTuyaNumber] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
}


@pytest.mark.asyncio
async def test_lock():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaRemote)
entities: list[LocalTuyaRemote] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
DPS_STATUS = {"5": "back"}


@pytest.mark.asyncio
async def test_lock():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaSelect)
entities: list[LocalTuyaSelect] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_siren.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
DPS_STATUS = {"5": STATE_ON}


@pytest.mark.asyncio
async def test_siren():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaSiren)
entities: list[LocalTuyaSiren] = get_entites(device)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_switch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test for localtuya."""

from . import *
from homeassistant.const import EntityCategory
from custom_components.localtuya.switch import LocalTuyaSwitch, DOMAIN as SWITCH_DOMAIN

CONFIG = {
Expand Down Expand Up @@ -32,7 +33,6 @@
DPS_STATUS = {"1": True, "2": False}


@pytest.mark.asyncio
async def test_switch():
device = await init(CONFIG, SWITCH_DOMAIN, LocalTuyaSwitch)
entities: list[LocalTuyaSwitch] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
}


@pytest.mark.asyncio
async def test_vacuum():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaVacuum)
entities: list[LocalTuyaVacuum] = get_entites(device)
Expand Down
1 change: 0 additions & 1 deletion tests/test_water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
}


@pytest.mark.asyncio
async def test_water_heater():
device = await init(CONFIG, PLATFORM_DOMAIN, LocalTuyaWaterHeater)
entities: list[LocalTuyaWaterHeater] = get_entites(device)
Expand Down

0 comments on commit 857512a

Please sign in to comment.