Skip to content

Commit d8d2942

Browse files
committed
Also catch URLError waiting for ServerContainer
There was a race condition here because the server hasn't always started before we send a request to it. This was causing a lot of unnecessary test failures.
1 parent 4ced198 commit d8d2942

File tree

1 file changed

+2
-2
lines changed
  • modules/generic/testcontainers/generic

1 file changed

+2
-2
lines changed

modules/generic/testcontainers/generic/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from typing import Union
2-
from urllib.error import HTTPError
2+
from urllib.error import HTTPError, URLError
33
from urllib.request import urlopen
44

55
import httpx
@@ -40,7 +40,7 @@ def __init__(self, port: int, image: Union[str, DockerImage]) -> None:
4040
self.internal_port = port
4141
self.with_exposed_ports(self.internal_port)
4242

43-
@wait_container_is_ready(HTTPError)
43+
@wait_container_is_ready(HTTPError, URLError)
4444
def _connect(self) -> None:
4545
# noinspection HttpUrlsUsage
4646
url = self._create_connection_url()

0 commit comments

Comments
 (0)