Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Apr 21, 2024
1 parent 8c27a98 commit b340158
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 19 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
disable_error_code = [
"arg-type", # 7
"index", # 18
"no-untyped-def", # 16
"type-arg", # 15
]

Expand Down
2 changes: 1 addition & 1 deletion tests/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
TEST_DIR = Path(__file__).resolve().parent


def _test_schema(folder: Path, schema: vol.Schema, file_name: str):
def _test_schema(folder: Path, schema: vol.Schema, file_name: str) -> None:
if not Path(folder).joinpath(file_name).is_file():
pytest.skip(f"No {file_name} in: {folder.name}")

Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test_schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


def _test_schedule_schema(file_name: str, schema: vol.Schema) -> dict:
def read_dict_from_file(file_name: str):
def read_dict_from_file(file_name: str) -> dict:
with open(WORK_DIR.joinpath(file_name)) as f:
data: dict = json.load(f)
return data
Expand Down
13 changes: 5 additions & 8 deletions tests/tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class GatewayStub:
location = None


def pytest_generate_tests(metafunc: pytest.Metafunc):
def id_fnc(folder_path: Path):
def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
def id_fnc(folder_path: Path) -> str:
return folder_path.name

folders = [
Expand All @@ -54,10 +54,7 @@ def id_fnc(folder_path: Path):
metafunc.parametrize("folder", sorted(folders), ids=id_fnc)


# Use pytest --log-cli-level=WARNING to see the output


def test_config_refresh(folder: Path):
def test_config_refresh(folder: Path) -> None:
"""Test the loading a config, then an update_status() on top of that."""

if not Path(folder).joinpath(CONFIG_FILE_NAME).is_file():
Expand Down Expand Up @@ -86,7 +83,7 @@ def test_config_refresh(folder: Path):
loc._update_status(status)


def test_config_schemas(folder: Path):
def test_config_schemas(folder: Path) -> None:
"""Test the config schema for a location."""

if not Path(folder).joinpath(CONFIG_FILE_NAME).is_file():
Expand All @@ -101,7 +98,7 @@ def test_config_schemas(folder: Path):
_ = SCH_TEMPERATURE_CONTROL_SYSTEM(tcs_config)


def test_status_schemas(folder: Path):
def test_status_schemas(folder: Path) -> None:
"""Test the status schema for a location."""

if not Path(folder).joinpath(STATUS_FILE_NAME).is_file():
Expand Down
10 changes: 5 additions & 5 deletions tests/tests/test_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
WORK_DIR = f"{TEST_DIR}/systems"


def pytest_generate_tests(metafunc: pytest.Metafunc):
def id_fnc(folder_path: Path):
def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
def id_fnc(folder_path: Path) -> str:
return folder_path.name

folders = [
Expand All @@ -26,17 +26,17 @@ def id_fnc(folder_path: Path):
metafunc.parametrize("folder", sorted(folders), ids=id_fnc)


def test_user_account(folder: Path):
def test_user_account(folder: Path) -> None:
"""Test the user account schema against the corresponding JSON."""
_test_schema(folder, SCH_USER_ACCOUNT, "user_account.json")


def test_user_locations(folder: Path):
def test_user_locations(folder: Path) -> None:
"""Test the user locations config schema against the corresponding JSON."""
_test_schema(folder, SCH_FULL_CONFIG, "user_locations.json")


def test_location_status(folder: Path):
def test_location_status(folder: Path) -> None:
"""Test the location status schema against the corresponding JSON."""
for p in Path(folder).glob("status_*.json"):
_test_schema(folder, SCH_LOCN_STATUS, p.name)
2 changes: 1 addition & 1 deletion tests/tests_rf/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


@pytest.fixture(autouse=True)
def patches_for_tests(monkeypatch: pytest.MonkeyPatch):
def patches_for_tests(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr("evohomeasync2.base.aiohttp", aiohttp)
monkeypatch.setattr("evohomeasync2.broker.aiohttp", aiohttp)

Expand Down
2 changes: 1 addition & 1 deletion tests/tests_rf/test_v1_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
_LOGGER = logging.getLogger(__name__)


async def _test_client_apis(evo: evohome.EvohomeClient):
async def _test_client_apis(evo: evohome.EvohomeClient) -> None:
"""Instantiate a client, and logon to the vendor API."""

user_data = await evo._populate_user_data()
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_rf/test_v1_xxxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def _test_url_locations(evo: evohome.EvohomeClient) -> None:
)


async def _test_client_apis(evo: evohome.EvohomeClient):
async def _test_client_apis(evo: evohome.EvohomeClient) -> None:
"""Instantiate a client, and logon to the vendor API."""

user_data = await evo._populate_user_data()
Expand Down

0 comments on commit b340158

Please sign in to comment.