Skip to content

Commit

Permalink
tests: use socket's contextmanager implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sullyj3 committed Jul 31, 2024
1 parent 594e7f4 commit eeaec04
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,9 @@ def main():

@contextmanager
def client_socket():
try:
client_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client_sock:
client_sock.connect(SOCKET_PATH)
yield client_sock
finally:
client_sock.close()

def test_msg_and_response(test_name, msg, expected):
global failure
Expand Down

0 comments on commit eeaec04

Please sign in to comment.