diff options
author | Brian Quinlan <brian@sweetapp.com> | 2010-12-24 23:10:41 (GMT) |
---|---|---|
committer | Brian Quinlan <brian@sweetapp.com> | 2010-12-24 23:10:41 (GMT) |
commit | a3015a6a827ad852bf1875e6e40d64063d895cd4 (patch) | |
tree | 8507cb155f81bfd72ac93f406b7db34aa498739e /Lib/test/test_concurrent_futures.py | |
parent | dfd7eb0ba2f3296f28028970e395e38f3ae9eedc (diff) | |
download | cpython-a3015a6a827ad852bf1875e6e40d64063d895cd4.zip cpython-a3015a6a827ad852bf1875e6e40d64063d895cd4.tar.gz cpython-a3015a6a827ad852bf1875e6e40d64063d895cd4.tar.bz2 |
Better reporting of test failures on Windows.
Diffstat (limited to 'Lib/test/test_concurrent_futures.py')
-rw-r--r-- | Lib/test/test_concurrent_futures.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index e4e38ec..7baf0a2 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -75,15 +75,27 @@ class Call(object): def _wait_on_event(self, handle): if sys.platform.startswith('win'): + # WaitForSingleObject returns 0 if handle is signaled. r = ctypes.windll.kernel32.WaitForSingleObject(handle, 60 * 1000) - assert r == 0 + if r != 0: + message = ( + 'WaitForSingleObject({}, ...) failed with {}, ' + 'GetLastError() = {}'.format( + handle, r, ctypes.GetLastError())) + logging.critical(message) + assert False, message else: self.CALL_LOCKS[handle].wait() def _signal_event(self, handle): if sys.platform.startswith('win'): - r = ctypes.windll.kernel32.SetEvent(handle) - assert r != 0 + r = ctypes.windll.kernel32.SetEvent(handle) # Returns 0 on failure. + if r == 0: + message = ( + 'SetEvent({}) failed with {}, GetLastError() = {}'.format( + handle, r, ctypes.GetLastError())) + logging.critical(message) + assert False, message else: self.CALL_LOCKS[handle].set() |