mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Merged revisions 78523 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78523 | gregory.p.smith | 2010-02-28 16:05:08 -0800 (Sun, 28 Feb 2010) | 3 lines Issue #1068268: The subprocess module now handles EINTR in internal os.waitpid and os.read system calls where appropriate. ........
This commit is contained in:
parent
3fdd9648cb
commit
a59c59f946
3 changed files with 37 additions and 4 deletions
|
@ -4,6 +4,7 @@ import subprocess
|
|||
import sys
|
||||
import signal
|
||||
import os
|
||||
import errno
|
||||
import tempfile
|
||||
import time
|
||||
import re
|
||||
|
@ -797,12 +798,31 @@ class ProcessTestCaseNoPoll(ProcessTestCase):
|
|||
ProcessTestCase.tearDown(self)
|
||||
|
||||
|
||||
class HelperFunctionTests(unittest.TestCase):
|
||||
def test_eintr_retry_call(self):
|
||||
record_calls = []
|
||||
def fake_os_func(*args):
|
||||
record_calls.append(args)
|
||||
if len(record_calls) == 2:
|
||||
raise OSError(errno.EINTR, "fake interrupted system call")
|
||||
return tuple(reversed(args))
|
||||
|
||||
self.assertEqual((999, 256),
|
||||
subprocess._eintr_retry_call(fake_os_func, 256, 999))
|
||||
self.assertEqual([(256, 999)], record_calls)
|
||||
# This time there will be an EINTR so it will loop once.
|
||||
self.assertEqual((666,),
|
||||
subprocess._eintr_retry_call(fake_os_func, 666))
|
||||
self.assertEqual([(256, 999), (666,), (666,)], record_calls)
|
||||
|
||||
|
||||
def test_main():
|
||||
unit_tests = (ProcessTestCase,
|
||||
POSIXProcessTestCase,
|
||||
Win32ProcessTestCase,
|
||||
CommandTests,
|
||||
ProcessTestCaseNoPoll)
|
||||
ProcessTestCaseNoPoll,
|
||||
HelperFunctionTests)
|
||||
|
||||
support.run_unittest(*unit_tests)
|
||||
support.reap_children()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue