summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-02-09 15:49:45 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:53:55 -0300
commit8c29de6075710febdeafaa8c3c78d6c085d5f757 (patch)
tree707ac1645bc99fb0904853db07bb36dfc569b2ce
parentf81fc0390a48512f8e7d95695c2a1e43c49ce573 (diff)
Updated http server used on tests to keep trying until get a free address.
-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 efaf588b..723a5dcd 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