Skip to content

Commit a51e18f

Browse files
Merge pull request #24 from vasuarez/master
catch ConnectionError at start up
2 parents f6ac860 + 5a99a5d commit a51e18f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

wiremock/server/server.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ def start(self):
5757
attempts = 0
5858
success = False
5959
while attempts < self.max_attempts:
60-
attempts += 1
61-
resp = requests.get("http://localhost:{}/__admin".format(self.port))
62-
if resp.status_code == 200:
63-
success = True
64-
break
65-
time.sleep(0.25)
60+
try:
61+
attempts += 1
62+
resp = requests.get("http://localhost:{}/__admin".format(self.port))
63+
if resp.status_code == 200:
64+
success = True
65+
break
66+
time.sleep(0.25)
67+
except requests.exceptions.ConnectionError:
68+
pass
6669

6770
if not success:
6871
raise WireMockServerNotStartedError("unable to get a successful GET http://localhost:{}/__admin response".format(self.port))

0 commit comments

Comments
 (0)