diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-03 21:53:14 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-03 21:53:14 (GMT) |
commit | 67dfb6f08662791618c3c1dc6016df29b98d0336 (patch) | |
tree | b2cb6d31f5e252413efcfc3b287c671355576661 /Lib | |
parent | 10be2ea85d081bc5b2b0529b76d104d749707394 (diff) | |
download | cpython-67dfb6f08662791618c3c1dc6016df29b98d0336.zip cpython-67dfb6f08662791618c3c1dc6016df29b98d0336.tar.gz cpython-67dfb6f08662791618c3c1dc6016df29b98d0336.tar.bz2 |
I think the test_logging failure on Solaris is timing related. We don't
want to wait forever if we don't receive the last message. But we also
don't want the test to fail if we shutdown too quickly. I can't reliably
reproduce this failure, so I'm kinda guessing this is the problem.
We'll see if this band-aid helps.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_logging.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index bf1e234..83c3b4f 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -98,13 +98,22 @@ 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: - rd, wr, ex = select.select([self.socket.fileno()], - [], [], - self.timeout) - if rd: - self.handle_request() + 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() #notify the main thread that we're about to exit socketDataProcessed.set() # close the listen socket |