end_time = time.time() + timeout
try:
port_path.touch(exist_ok=False)
- except FileExistsError:
+ except FileExistsError as ex:
raise ValueError(
- "Port {} already reserved by system or another kresd instance!".format(port))
+ "Port {} already reserved by system or another kresd instance!".format(port)) from ex
while True:
if is_port_free(port, ip, ip6):
try:
time.sleep(0.2) # give kresd time to close connection with TCP FIN
yield
- except ConnectionResetError:
+ except ConnectionResetError as ex:
if rst_ok:
- raise BrokenPipeError
+ raise BrokenPipeError from ex
pytest.skip("kresd closed connection with TCP RST")
pytest.fail("kresd didn't close the connection")