summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-07-31 19:41:09 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-07-31 20:13:40 +0300
commit780538db85f68288a58fb166d015e4b38b5ac633 (patch)
treea90ce6fd2a6631c2a193bd574829d2080a894ddf
parenta506d11d699deca92e5e62e214d206c5917e20c7 (diff)
kmstest: Raise clear exception when property is not found
When converting a property value string to an integer, if the property is not found, an AttributeError exception is raised and reports that "'NoneType' object has no attribute 'type'". This isn't very clear, replace it with a RuntimeError with a proper message. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rwxr-xr-xtests/kmstest.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/kmstest.py b/tests/kmstest.py
index e84d8fe..3e53def 100755
--- a/tests/kmstest.py
+++ b/tests/kmstest.py
@@ -268,6 +268,8 @@ class AtomicRequest(pykms.AtomicReq):
if isinstance(v, str):
if v.endswith('%'):
prop = obj.get_prop(k)
+ if not prop:
+ raise RuntimeError(f'Property {k} not supported by object {obj}')
if prop.type not in (pykms.PropertyType.Range, pykms.PropertyType.SignedRange):
raise RuntimeError(f'Unsupported property type {prop.type} for value {v}')