-
-
Notifications
You must be signed in to change notification settings - Fork 2k
pyvmomi.vmodl: ManagedObjectNotFound should be derived from Exception #8082
Copy link
Copy link
Closed
Description
Mypy is raising errors where we use vmodl.fault.ManagedObjectNotFound where an Exception instance is expected.
Python 3.10.5
mypy==0.961
pyvmomi==7.0.3
types-pyvmomi==7.0.7
I tested in the repl and the instances are inheriting from Exception at runtime:
>>> isinstance(vmodl.fault.ManagedObjectNotFound(), Exception)
True
The pyi file is declaring it as a plain object which is false:
class InvalidArgument(Exception): ...
class ManagedObjectNotFound:
obj: ManagedObject
It should be updated with the correct inheritance:
>>> vmodl.fault.ManagedObjectNotFound.__bases__
(<class 'pyVmomi.VmomiSupport.vmodl.RuntimeFault'>,)
>>> vmodl.RuntimeFault
<class 'pyVmomi.VmomiSupport.vmodl.RuntimeFault'>
>>> vmodl.RuntimeFault.__bases__
(<class 'pyVmomi.VmomiSupport.vmodl.MethodFault'>,)
>>> vmodl.MethodFault.__bases__
(<class 'pyVmomi.VmomiSupport.vmodl.DynamicData'>, <class 'Exception'>)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels