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.
This commit is contained in:
1 parent
3a991970b8
commit
991cae7e8d
2 files changed
+9
-9
No files matched your search
+6
-4
@@ -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"]
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in new issue
Block a user