laconicd-deprecated/tests/integration_tests/utils.py
crypto-facs fd0e62a067
imp(tests): integration tests setup (#1196)
* first pass

* latest

* working tests

* github actions

* remove unnecessary change

* remove unnecessary steps

* remove unnecessary import

* remove unnecessary change

* Update .github/workflows/test.yml

Co-authored-by: yihuang <huang@crypto.com>

* update .gitignore

* update github actions

* change evm denomination

* change evm denomination

* send tests to tests folder

* Delete result

* update go version

Co-authored-by: yihuang <huang@crypto.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-07-27 13:27:07 +00:00

17 lines
565 B
Python

import socket
import time
def wait_for_port(port, host="127.0.0.1", timeout=40.0):
start_time = time.perf_counter()
while True:
try:
with socket.create_connection((host, port), timeout=timeout):
break
except OSError as ex:
time.sleep(0.1)
if time.perf_counter() - start_time >= timeout:
raise TimeoutError(
"Waited too long for the port {} on host {} to start accepting "
"connections.".format(port, host)
) from ex