Skip to content

Commit 9104425

Browse files
committed
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 <[email protected]>
1 parent 09e558a commit 9104425

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/integration_tests/functional/test_vsock.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,11 @@ def test_vsock_transport_reset_h2g(
187187
# it shouldn't receive anything.
188188
worker.sock.settimeout(0.25)
189189
response = worker.sock.recv(32)
190-
if response != b"":
191-
# If we reach here, it means the connection did not close.
192-
assert False, "Connection not closed: response recieved '{}'".format(
193-
response.decode("utf-8")
194-
)
190+
assert (
191+
response == b""
192+
), f"Connection not closed: response recieved '{response.decode('utf-8')}'"
195193
except (SocketTimeout, ConnectionResetError, BrokenPipeError):
196-
assert True
194+
pass
197195

198196
# Terminate VM.
199197
metrics = test_vm.flush_metrics()

0 commit comments

Comments
 (0)