Skip to content
  • Kevin Wolf's avatar
    503c2b31
    iotests.py: Fix type check errors in wait_migration() · 503c2b31
    Kevin Wolf authored
    
    
    Commit 1847a4a8 clarified that event_wait() can return None (though
    only with timeout=0) and commit f12a282f annotated it as returning
    Optional[QMPMessage].
    
    Type checks in wait_migration() fail because of the unexpected optional
    return type:
    
    iotests.py:750: error: Value of type variable "Msg" of "log" cannot be "Optional[Dict[str, Any]]"
    iotests.py:751: error: Value of type "Optional[Dict[str, Any]]" is not indexable
    iotests.py:754: error: Value of type "Optional[Dict[str, Any]]" is not indexable
    
    Fortunately, the non-zero default timeout is used in the event_wait()
    call, so we can make mypy happy by just asserting this.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20201027163806.290960-2-kwolf@redhat.com>
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    503c2b31
    iotests.py: Fix type check errors in wait_migration()
    Kevin Wolf authored
    
    
    Commit 1847a4a8 clarified that event_wait() can return None (though
    only with timeout=0) and commit f12a282f annotated it as returning
    Optional[QMPMessage].
    
    Type checks in wait_migration() fail because of the unexpected optional
    return type:
    
    iotests.py:750: error: Value of type variable "Msg" of "log" cannot be "Optional[Dict[str, Any]]"
    iotests.py:751: error: Value of type "Optional[Dict[str, Any]]" is not indexable
    iotests.py:754: error: Value of type "Optional[Dict[str, Any]]" is not indexable
    
    Fortunately, the non-zero default timeout is used in the event_wait()
    call, so we can make mypy happy by just asserting this.
    
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20201027163806.290960-2-kwolf@redhat.com>
    Reviewed-by: default avatarJohn Snow <jsnow@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading