def METHOD_NAME(self):
    def _fail(*args, **kwargs):
        e = libvirt.libvirtError("timeout")
        e.err = (libvirt.VIR_ERR_NO_DOMAIN_METADATA, '', 'random error')
        raise e
    self.libvirtdom.state = _fail
    with pytest.raises(libvirt.libvirtError):
        # any method is fine
        self.dom.state(0)
    assert self.elapsed is None