chore: adopt the NAPALM driver standard #11

Merged
christianmanivong merged 3 commits from chore/driver-standard into main 2026-10-23 14:46:42 +00:00
2 changed files with 9 additions and 9 deletions
Showing only changes of commit 991cae7e8d - Show all commits

No files matched your search

+6 -4
View File
@@ -73,9 +73,11 @@ testpaths = ["tests"]
[tool.ruff] [tool.ruff]
line-length = 100 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] [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"]
+3 -5
View File
@@ -105,9 +105,7 @@ class TestRolesDoNotShadowLinux:
owner = next(k for k in QnapQtsDriver.__mro__ if method in k.__dict__) owner = next(k for k in QnapQtsDriver.__mro__ if method in k.__dict__)
assert owner is LinuxDriver assert owner is LinuxDriver
@pytest.mark.parametrize( @pytest.mark.parametrize("method", ["get_packages", "install_package", "uninstall_package"])
"method", ["get_packages", "install_package", "uninstall_package"]
)
def test_package_surface_is_refused_deliberately(self, method): def test_package_surface_is_refused_deliberately(self, method):
"""QTS has no apt/dnf, so LinuxDriver's versions must not be inherited """QTS has no apt/dnf, so LinuxDriver's versions must not be inherited
silently -- this driver overrides them to refuse.""" silently -- this driver overrides them to refuse."""
@@ -117,7 +115,8 @@ class TestRolesDoNotShadowLinux:
def test_no_forwarding_methods_remain(self): def test_no_forwarding_methods_remain(self):
"""A forwarder here would mean the shadowing came back.""" """A forwarder here would mean the shadowing came back."""
own = { own = {
name for name, val in vars(QnapQtsDriver).items() name
for name, val in vars(QnapQtsDriver).items()
if callable(val) and not name.startswith("__") if callable(val) and not name.startswith("__")
} }
assert "get_services" not in own assert "get_services" not in own
@@ -216,7 +215,6 @@ def test_services_cannot_be_controlled():
assert not callable(getattr(QnapQtsDriver, "manage_service", None)) assert not callable(getattr(QnapQtsDriver, "manage_service", None))
def test_updates_are_not_read_or_applied_here(): def test_updates_are_not_read_or_applied_here():
"""QTS has no apt, dnf or opkg: the readers inherited from LinuxDriver find no """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 package manager, and QPKG updates are not implemented. Saying so keeps QNAP out