diff --git a/tests/conftest.py b/tests/conftest.py index 76d39d30..76f5c7c1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -27,7 +27,6 @@ settings.cashu_dir = "./test_data/" settings.mint_host = "localhost" settings.mint_port = SERVER_PORT -settings.mint_host = "0.0.0.0" settings.mint_listen_port = SERVER_PORT settings.mint_url = SERVER_ENDPOINT settings.tor = False @@ -139,6 +138,16 @@ def mint(): server = UvicornServer(config=config) server.start() - time.sleep(1) + + # Wait until the server has bound to the localhost socket. Max out after 10s. + tries = 0 + while tries < 100: + try: + httpx.get(settings.mint_url) + except: + tries += 1 + time.sleep(0.1) + + yield server server.stop()