summaryrefslogtreecommitdiffstats
path: root/python/qemu/qtest.py
diff options
context:
space:
mode:
authorJohn Snow2020-05-29 00:21:28 +0200
committerPhilippe Mathieu-Daudé2020-05-31 18:25:30 +0200
commit9b8ccd6d5b81f10436764bf7e334e087f3918d12 (patch)
tree66909a96a6c62bfbdf349b49ddd6a725a7f35141 /python/qemu/qtest.py
parentpython/qemu/machine: remove logging configuration (diff)
downloadqemu-9b8ccd6d5b81f10436764bf7e334e087f3918d12.tar.gz
qemu-9b8ccd6d5b81f10436764bf7e334e087f3918d12.tar.xz
qemu-9b8ccd6d5b81f10436764bf7e334e087f3918d12.zip
python/qemu: delint and add pylintrc
Bring our these files up to speed with pylint 2.5.0. Add a pylintrc file to formalize which pylint subset we are targeting. The similarity ignore is there to suppress similarity reports across imports, which for typing constants, are going to trigger this report erroneously. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200528222129.23826-4-jsnow@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'python/qemu/qtest.py')
-rw-r--r--python/qemu/qtest.py42
1 files changed, 27 insertions, 15 deletions
diff --git a/python/qemu/qtest.py b/python/qemu/qtest.py
index d24ad04256..53d814c064 100644
--- a/python/qemu/qtest.py
+++ b/python/qemu/qtest.py
@@ -1,5 +1,11 @@
-# QEMU qtest library
-#
+"""
+QEMU qtest library
+
+qtest offers the QEMUQtestProtocol and QEMUQTestMachine classes, which
+offer a connection to QEMU's qtest protocol socket, and a qtest-enabled
+subclass of QEMUMachine, respectively.
+"""
+
# Copyright (C) 2015 Red Hat Inc.
#
# Authors:
@@ -17,19 +23,21 @@ import os
from .machine import QEMUMachine
-class QEMUQtestProtocol(object):
- def __init__(self, address, server=False):
- """
- Create a QEMUQtestProtocol object.
+class QEMUQtestProtocol:
+ """
+ QEMUQtestProtocol implements a connection to a qtest socket.
- @param address: QEMU address, can be either a unix socket path (string)
- or a tuple in the form ( address, port ) for a TCP
- connection
- @param server: server mode, listens on the socket (bool)
- @raise socket.error on socket connection errors
- @note No connection is established, this is done by the connect() or
- accept() methods
- """
+ :param address: QEMU address, can be either a unix socket path (string)
+ or a tuple in the form ( address, port ) for a TCP
+ connection
+ :param server: server mode, listens on the socket (bool)
+ :raise socket.error: on socket connection errors
+
+ .. note::
+ No conection is estabalished by __init__(), this is done
+ by the connect() or accept() methods.
+ """
+ def __init__(self, address, server=False):
self._address = address
self._sock = self._get_sock()
self._sockfile = None
@@ -73,15 +81,19 @@ class QEMUQtestProtocol(object):
return resp
def close(self):
+ """Close this socket."""
self._sock.close()
self._sockfile.close()
def settimeout(self, timeout):
+ """Set a timeout, in seconds."""
self._sock.settimeout(timeout)
class QEMUQtestMachine(QEMUMachine):
- '''A QEMU VM'''
+ """
+ A QEMU VM, with a qtest socket available.
+ """
def __init__(self, binary, args=None, name=None, test_dir="/var/tmp",
socket_scm_helper=None, sock_dir=None):