Skip to content

Commit 6f7363e

Browse files
committed
Add pylint (generically) and force pytest
1 parent 6c37bcd commit 6f7363e

File tree

8 files changed

+36
-13
lines changed

8 files changed

+36
-13
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ repos:
4949
- --quiet
5050
- --format=custom
5151
- --configfile=tests/bandit.yaml
52-
files: ^(airos|tests)/.+\.py$
52+
files: ^(airos|tests|script)/.+\.py$
5353
- repo: https://github.com/adrienverge/yamllint.git
5454
rev: v1.37.1
5555
hooks:
@@ -75,17 +75,30 @@ repos:
7575
- --py39-plus
7676
- --force
7777
- --keep-updates
78-
files: ^(airos|tests)/.+\.py$
78+
files: ^(airos|tests|script)/.+\.py$
7979
- repo: https://github.com/igorshubovych/markdownlint-cli
8080
rev: v0.45.0
8181
hooks:
8282
- id: markdownlint
8383
- repo: local
8484
hooks:
85+
- id: pytest
86+
name: "pytest"
87+
entry: script/run-in-env.sh pytest
88+
language: script
89+
types: [python]
90+
pass_filenames: false
91+
files: ^(airos|tests|script)/.+\.py$
92+
- id: pylint
93+
name: "pylinting"
94+
entry: script/run-in-env.sh pylint -j 0
95+
language: script
96+
types: [python]
97+
files: ^(airos|tests|script)/.+\.py$
8598
- id: mypy
8699
name: mypy
87100
entry: script/run-in-env.sh mypy
88101
language: script
89102
require_serial: true
90103
types_or: [python, pyi]
91-
files: ^(airos|tests|scripts)/.+\.(py|pyi)$
104+
files: ^(airos|tests|script)/.+\.(py|pyi)$

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.2.10] - 2025-08-13
6+
7+
### Changed
8+
9+
- Maintenance chores
10+
- Added pylint and pytest (and applicable changes)
11+
512
## [0.2.9] - 2025-08-12
613

714
### Changed

airos/airos8.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ async def login(self) -> bool:
193193
_LOGGER.info("Login task was cancelled")
194194
raise
195195

196-
def derived_data(self, response: dict[str, Any] = {}) -> dict[str, Any]:
196+
def derived_data(self, response: dict[str, Any]) -> dict[str, Any]:
197197
"""Add derived data to the device response."""
198198
derived: dict[str, Any] = {
199199
"station": False,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "airos"
7-
version = "0.2.9"
7+
version = "0.2.10"
88
license = "MIT"
99
description = "Ubiquity airOS module(s) for Python 3."
1010
readme = "README.md"

script/generate_ha_fixture.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ def generate_airos_fixtures() -> None:
4242
_LOGGER.info("Processing '%s'...", filename)
4343

4444
try:
45-
with open(base_fixture_path) as source:
45+
with open(base_fixture_path, encoding="utf-8") as source:
4646
source_data = json.loads(source.read())
4747

4848
derived_data = AirOS.derived_data(None, source_data) # type: ignore[arg-type]
4949
new_data = AirOSData.from_dict(derived_data)
5050

51-
with open(new_fixture_path, "w") as new:
51+
with open(new_fixture_path, "w", encoding="utf-8") as new:
5252
json.dump(new_data.to_dict(), new, indent=2, sort_keys=True)
5353

5454
_LOGGER.info("Successfully created '%s'", new_filename)

script/mashumaro-step-debug.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import sys
77
from typing import Any
88

9-
current_script_dir = os.path.dirname(os.path.abspath(__file__))
10-
project_root_dir = os.path.abspath(os.path.join(current_script_dir, os.pardir))
9+
_current_script_dir = os.path.dirname(os.path.abspath(__file__))
10+
_project_root_dir = os.path.abspath(os.path.join(_current_script_dir, os.pardir))
1111

12-
if project_root_dir not in sys.path:
13-
sys.path.append(project_root_dir)
12+
if _project_root_dir not in sys.path:
13+
sys.path.append(_project_root_dir)
1414

1515
from airos.data import AirOS8Data, Interface, Remote, Station, Wireless # noqa: E402
1616

@@ -31,7 +31,7 @@ def main() -> None:
3131
sys.path.append(project_root_dir)
3232

3333
# Load the JSON data
34-
with open(sys.argv[1]) as f:
34+
with open(sys.argv[1], encoding="utf-8") as f:
3535
data = json.loads(f.read())
3636

3737
try:
@@ -65,7 +65,6 @@ def main() -> None:
6565

6666
_LOGGER.info(" -> Checking list of Interface objects...")
6767
interfaces = data["interfaces"]
68-
interface_obj_list = [] # noqa: F841
6968
for i, interface_data in enumerate(interfaces):
7069
_LOGGER.info(" -> Checking Interface object at index %s...", i)
7170
_LOGGER.info(" Interface should be %s.", interface_data["ifname"])

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
import aiohttp
1212

13+
# pylint: disable=redefined-outer-name, unnecessary-default-type-args
14+
1315

1416
@pytest.fixture
1517
def base_url() -> str:

tests/test_discovery.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from airos.exceptions import AirOSDiscoveryError, AirOSEndpointError, AirOSListenerError
1616
import pytest
1717

18+
# pylint: disable=redefined-outer-name
19+
1820

1921
# Helper to load binary fixture
2022
async def _read_binary_fixture(fixture_name: str) -> bytes:

0 commit comments

Comments
 (0)