driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 58s
driver / test (3.13) (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m10s
driver / lowest (pull_request) Successful in 36s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 52s
CI / driver (pull_request) Successful in 2m12s
driver / publish (pull_request) Skipped
OpenWrt keeps its package index in RAM and loses it on every reboot. get_available_updates() raises then, rightly, but only as a bare RuntimeError, so a caller cannot tell it from a read that failed and reports a communication error for a state a refresh cures. PackageIndexMissing (a RuntimeError, so existing callers still catch it) names that case; refresh_available_updates() is the way out. Refs NetOrk/netork#2527
21 lines
783 B
Python
21 lines
783 B
Python
"""The contract of :class:`~napalm_device_types.updates.UpdateMixin`."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import napalm_device_types
|
|
from napalm_device_types.updates import PackageIndexMissing
|
|
|
|
|
|
def test_a_missing_index_is_its_own_failure():
|
|
"""A reader can tell "no index to read from" from any other failure, and a
|
|
caller that only knows failures still catches it as one."""
|
|
exc = PackageIndexMissing("The package index is not loaded (run apk update first)")
|
|
|
|
assert isinstance(exc, RuntimeError)
|
|
assert str(exc) == "The package index is not loaded (run apk update first)"
|
|
|
|
|
|
def test_it_is_exported_from_the_package():
|
|
assert napalm_device_types.PackageIndexMissing is PackageIndexMissing
|
|
assert "PackageIndexMissing" in napalm_device_types.__all__
|