From 991cae7e8d9cf6e5705159467823002ee98930b6 Mon Sep 17 00:00:00 2001 From: Christian Manivong Date: Fri, 23 Oct 2026 12:08:18 +0200 Subject: [PATCH] style: ruff format and the lint rules of the driver standard Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff cannot fix comes in the next commit. --- pyproject.toml | 10 ++++++---- tests/test_qnap_qts.py | 8 +++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bfd36f2..122ce48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,9 +73,11 @@ testpaths = ["tests"] [tool.ruff] line-length = 100 -target-version = "py39" +target-version = "py310" -# Same rule set the netOrk repo gates on, so this driver is held to the -# standard of the project that consumes it rather than to ruff's defaults. [tool.ruff.lint] -select = ["E", "F", "I", "UP"] +select = ["E", "F", "I", "UP", "B"] + +[tool.ruff.lint.per-file-ignores] +# Recorded device output keeps its lines. +"tests/**" = ["E501"] diff --git a/tests/test_qnap_qts.py b/tests/test_qnap_qts.py index b0870f6..34da812 100644 --- a/tests/test_qnap_qts.py +++ b/tests/test_qnap_qts.py @@ -105,9 +105,7 @@ class TestRolesDoNotShadowLinux: owner = next(k for k in QnapQtsDriver.__mro__ if method in k.__dict__) assert owner is LinuxDriver - @pytest.mark.parametrize( - "method", ["get_packages", "install_package", "uninstall_package"] - ) + @pytest.mark.parametrize("method", ["get_packages", "install_package", "uninstall_package"]) def test_package_surface_is_refused_deliberately(self, method): """QTS has no apt/dnf, so LinuxDriver's versions must not be inherited silently -- this driver overrides them to refuse.""" @@ -117,7 +115,8 @@ class TestRolesDoNotShadowLinux: def test_no_forwarding_methods_remain(self): """A forwarder here would mean the shadowing came back.""" own = { - name for name, val in vars(QnapQtsDriver).items() + name + for name, val in vars(QnapQtsDriver).items() if callable(val) and not name.startswith("__") } assert "get_services" not in own @@ -216,7 +215,6 @@ def test_services_cannot_be_controlled(): assert not callable(getattr(QnapQtsDriver, "manage_service", None)) - def test_updates_are_not_read_or_applied_here(): """QTS has no apt, dnf or opkg: the readers inherited from LinuxDriver find no package manager, and QPKG updates are not implemented. Saying so keeps QNAP out