fd0e62a067
* 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>
17 lines
565 B
Python
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
|