diff options
author | Mattias Nissler <122288598+mnissler-rivos@users.noreply.github.com> | 2023-08-31 11:38:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-31 10:38:55 +0100 |
commit | a7eedffe20bd6e480c9e2c65e68daef1beb2af05 (patch) | |
tree | 37f46c9cbf8de3fbb0622b7472157d60f1b8550f /test/py/test_negotiate.py | |
parent | 2e8ec2e17a5252d29bae849eb4ccd7ca6bab216a (diff) | |
download | libvfio-user-a7eedffe20bd6e480c9e2c65e68daef1beb2af05.zip libvfio-user-a7eedffe20bd6e480c9e2c65e68daef1beb2af05.tar.gz libvfio-user-a7eedffe20bd6e480c9e2c65e68daef1beb2af05.tar.bz2 |
Introduce client object in python tests (#772)
Thus far, the client end of the socket is the only piece of client state
tracked in tests, for which a global `socket` variable has been used. In
preparation to add more state, replace the `socket` global with a
`client` global object that groups all client state.
Signed-off-by: Mattias Nissler <mnissler@rivosinc.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test/py/test_negotiate.py')
-rw-r--r-- | test/py/test_negotiate.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/py/test_negotiate.py b/test/py/test_negotiate.py index b018840..7404902 100644 --- a/test/py/test_negotiate.py +++ b/test/py/test_negotiate.py @@ -161,15 +161,15 @@ def test_invalid_json_bad_pgsize2(): def test_valid_negotiate_no_json(): - sock = connect_sock() + client = Client(sock=connect_sock()) payload = struct.pack("HH", LIBVFIO_USER_MAJOR, LIBVFIO_USER_MINOR) hdr = vfio_user_header(VFIO_USER_VERSION, size=len(payload)) - sock.send(hdr + payload) + client.sock.send(hdr + payload) vfu_attach_ctx(ctx) - payload = get_reply(sock) + payload = get_reply(client.sock) (major, minor, json_str, _) = struct.unpack("HH%dsc" % (len(payload) - 5), payload) assert major == LIBVFIO_USER_MAJOR @@ -179,7 +179,7 @@ def test_valid_negotiate_no_json(): assert json.capabilities.max_data_xfer_size == SERVER_MAX_DATA_XFER_SIZE # FIXME: migration object checks - disconnect_client(ctx, sock) + client.disconnect(ctx) def test_valid_negotiate_empty_json(): |