diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-05 02:16:12 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-05 02:16:12 (GMT) |
commit | 5bab0f887295beeb8aad1b252863b93fd4f07f6a (patch) | |
tree | 12cffa96a0e597031a9fdb1885a59437023d34d0 | |
parent | 83cbb24cd4d7ae3b6737956ee1b6471bc322b8fa (diff) | |
download | cpython-5bab0f887295beeb8aad1b252863b93fd4f07f6a.zip cpython-5bab0f887295beeb8aad1b252863b93fd4f07f6a.tar.gz cpython-5bab0f887295beeb8aad1b252863b93fd4f07f6a.tar.bz2 |
Backout the last hack and add in this new one.
The failure definitely seems timing related. This change *seems* to work.
Since the failure isn't doesn't occur consistently, it's hard to tell.
Running these tests on Solaris in this order:
test_urllibnet test_operator test_cgi \
test_isinstance test_future test_ast test_logging
generally caused a failure (about 50% of the time) before the sleep.
I couldn't provoke the failure with the sleep.
This should really be cleaned up by using threading.Events or something
so it is not timing dependent and doesn't hang forever on failure.
-rw-r--r-- | Lib/test/test_logging.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 83c3b4f..b689dc8 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -98,22 +98,12 @@ class LogRecordSocketReceiver(ThreadingTCPServer): self.abort = 0 self.timeout = 1 - def _wait_and_process_data(self): - rd, wr, ex = select.select([self.socket.fileno()], [], [], - self.timeout) - if rd: - self.handle_request() - def serve_until_stopped(self): while not self.abort: - self._wait_and_process_data() - - # XXX(nnorwitz): Try to fix timing related test failures. - # It's possible self.aborted was set before the final message - # was received. By calling _wait_and_process_data(), - # it gives us one last chance to read messages. - # The test generally only fails on Solaris. - self._wait_and_process_data() + rd, wr, ex = select.select([self.socket.fileno()], [], [], + self.timeout) + if rd: + self.handle_request() #notify the main thread that we're about to exit socketDataProcessed.set() # close the listen socket @@ -633,6 +623,10 @@ def test_main_inner(): rootLogger.addHandler(shdlr) test0() + # XXX(nnorwitz): Try to fix timing related test failures. + # This sleep gives us some extra time to read messages. + # The test generally only fails on Solaris without this sleep. + time.sleep(2.0) shdlr.close() rootLogger.removeHandler(shdlr) |