diff options
author | Renato Araujo Oliveira Filho <renato.filho@openbossa.org> | 2011-02-09 15:49:45 -0300 |
---|---|---|
committer | Renato Araujo Oliveira Filho <renato.filho@openbossa.org> | 2011-02-09 15:49:45 -0300 |
commit | 5a87a51c119395cd12633d02a3c9558c32a73a43 (patch) | |
tree | 30a6f792c9ed148e6cdbf587ff317d6a6891cffc | |
parent | 323b37bedadbef313a513ded818e326b6e5f2dcd (diff) | |
download | pyside-5a87a51c119395cd12633d02a3c9558c32a73a43.tar.gz pyside-5a87a51c119395cd12633d02a3c9558c32a73a43.tar.xz pyside-5a87a51c119395cd12633d02a3c9558c32a73a43.zip |
Updated http server used on tests to keep trying until get a free address.
-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 efaf588..723a5dc 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 |