Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(91043)

Side by Side Diff: Lib/test/test_file_eintr.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_fcntl.py ('k') | Lib/test/test_gc.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Written to test interrupted system calls interfering with our many buffered 1 # Written to test interrupted system calls interfering with our many buffered
2 # IO implementations. http://bugs.python.org/issue12268 2 # IO implementations. http://bugs.python.org/issue12268
3 # 3 #
4 # It was suggested that this code could be merged into test_io and the tests 4 # It was suggested that this code could be merged into test_io and the tests
5 # made to work using the same method as the existing signal tests in test_io. 5 # made to work using the same method as the existing signal tests in test_io.
6 # I was unable to get single process tests using alarm or setitimer that way 6 # I was unable to get single process tests using alarm or setitimer that way
7 # to reproduce the EINTR problems. This process based test suite reproduces 7 # to reproduce the EINTR problems. This process based test suite reproduces
8 # the problems prior to the issue12268 patch reliably on Linux and OSX. 8 # the problems prior to the issue12268 patch reliably on Linux and OSX.
9 # - gregory.p.smith 9 # - gregory.p.smith
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 self._process.terminate() # Ensure it dies. 62 self._process.terminate() # Ensure it dies.
63 except OSError: 63 except OSError:
64 pass 64 pass
65 if communicate: 65 if communicate:
66 stdout_end, stderr_end = self._process.communicate() 66 stdout_end, stderr_end = self._process.communicate()
67 stdout += stdout_end 67 stdout += stdout_end
68 stderr += stderr_end 68 stderr += stderr_end
69 self.fail('Error from IO process %s:\nSTDOUT:\n%sSTDERR:\n%s\n' % 69 self.fail('Error from IO process %s:\nSTDOUT:\n%sSTDERR:\n%s\n' %
70 (why, stdout.decode(), stderr.decode())) 70 (why, stdout.decode(), stderr.decode()))
71 71
72 @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess .Popen()")
72 def _test_reading(self, data_to_write, read_and_verify_code): 73 def _test_reading(self, data_to_write, read_and_verify_code):
73 """Generic buffered read method test harness to validate EINTR behavior. 74 """Generic buffered read method test harness to validate EINTR behavior.
74 75
75 Also validates that Python signal handlers are run during the read. 76 Also validates that Python signal handlers are run during the read.
76 77
77 Args: 78 Args:
78 data_to_write: String to write to the child process for reading 79 data_to_write: String to write to the child process for reading
79 before sending it a signal, confirming the signal was handled, 80 before sending it a signal, confirming the signal was handled,
80 writing a final newline and closing the infile pipe. 81 writing a final newline and closing the infile pipe.
81 read_and_verify_code: Single "line" of code to read from a file 82 read_and_verify_code: Single "line" of code to read from a file
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 244
244 class CTestTextIOSignalInterrupt(TestTextIOSignalInterrupt, unittest.TestCase): 245 class CTestTextIOSignalInterrupt(TestTextIOSignalInterrupt, unittest.TestCase):
245 modname = '_io' 246 modname = '_io'
246 247
247 class PyTestTextIOSignalInterrupt(TestTextIOSignalInterrupt, unittest.TestCase): 248 class PyTestTextIOSignalInterrupt(TestTextIOSignalInterrupt, unittest.TestCase):
248 modname = '_pyio' 249 modname = '_pyio'
249 250
250 251
251 if __name__ == '__main__': 252 if __name__ == '__main__':
252 unittest.main() 253 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_fcntl.py ('k') | Lib/test/test_gc.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+