From 9104425a7fc49155980f6804e8219f0af0b29c6c Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Fri, 13 Sep 2024 11:47:10 +0100 Subject: [PATCH] test: vsock: simplify assertions Remove `assert True` as that's just `pass` with extra steps. Remove `if bla: assert False` as that's just `assert bla` with extra steps. Signed-off-by: Patrick Roy --- tests/integration_tests/functional/test_vsock.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/integration_tests/functional/test_vsock.py b/tests/integration_tests/functional/test_vsock.py index 104fbada886..29323feddf4 100644 --- a/tests/integration_tests/functional/test_vsock.py +++ b/tests/integration_tests/functional/test_vsock.py @@ -187,13 +187,11 @@ def test_vsock_transport_reset_h2g( # it shouldn't receive anything. worker.sock.settimeout(0.25) response = worker.sock.recv(32) - if response != b"": - # If we reach here, it means the connection did not close. - assert False, "Connection not closed: response recieved '{}'".format( - response.decode("utf-8") - ) + assert ( + response == b"" + ), f"Connection not closed: response recieved '{response.decode('utf-8')}'" except (SocketTimeout, ConnectionResetError, BrokenPipeError): - assert True + pass # Terminate VM. metrics = test_vm.flush_metrics()