aboutsummaryrefslogtreecommitdiffstats
path: root/tests/util/httpd.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/util/httpd.py')
-rw-r--r--tests/util/httpd.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/util/httpd.py b/tests/util/httpd.py
index efaf588b6..723a5dcd9 100644
--- a/tests/util/httpd.py
+++ b/tests/util/httpd.py
@@ -124,11 +124,12 @@ class TestServer(threading.Thread):
else:
handle = TestHandler
- try:
- self.httpd = CompatTCPServer(('' , self._port), handle)
- except:
- self._port = self._port + random.randint(1, 100)
- self.httpd = CompatTCPServer(('' , self._port), handle)
+ while True:
+ try:
+ self.httpd = CompatTCPServer(('' , self._port), handle)
+ break
+ except:
+ self._port = self._port + random.randint(1, 100)
def port(self):
return self._port