diff options
author | Renato Araujo Oliveira Filho <renato.filho@openbossa.org> | 2011-02-09 15:49:45 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:53:55 -0300 |
commit | 8c29de6075710febdeafaa8c3c78d6c085d5f757 (patch) | |
tree | 707ac1645bc99fb0904853db07bb36dfc569b2ce /tests | |
parent | f81fc0390a48512f8e7d95695c2a1e43c49ce573 (diff) |
Updated http server used on tests to keep trying until get a free address.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/util/httpd.py | 11 |
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 |