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

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

Issue 18923: Use the new selectors module in the subprocess module
Patch Set: Created 5 years, 9 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
« Lib/subprocess.py ('K') | « Lib/subprocess.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import unittest 1 import unittest
2 from test import script_helper 2 from test import script_helper
3 from test import support 3 from test import support
4 import subprocess 4 import subprocess
5 import sys 5 import sys
6 import signal 6 import signal
7 import io 7 import io
8 import locale 8 import locale
9 import os 9 import os
10 import errno 10 import errno
(...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 dir = None 2177 dir = None
2178 try: 2178 try:
2179 dir = tempfile.mkdtemp() 2179 dir = tempfile.mkdtemp()
2180 name = os.path.join(dir, "foo") 2180 name = os.path.join(dir, "foo")
2181 2181
2182 status, output = subprocess.getstatusoutput('cat ' + name) 2182 status, output = subprocess.getstatusoutput('cat ' + name)
2183 self.assertNotEqual(status, 0) 2183 self.assertNotEqual(status, 0)
2184 finally: 2184 finally:
2185 if dir is not None: 2185 if dir is not None:
2186 os.rmdir(dir) 2186 os.rmdir(dir)
2187
2188
2189 @unittest.skipUnless(getattr(subprocess, '_has_poll', False),
2190 "poll system call not supported")
2191 class ProcessTestCaseNoPoll(ProcessTestCase):
haypo 2013/10/31 23:56:12 Oh oh, removing a test is not a good idea. You sho
2192 def setUp(self):
2193 subprocess._has_poll = False
2194 ProcessTestCase.setUp(self)
2195
2196 def tearDown(self):
2197 subprocess._has_poll = True
2198 ProcessTestCase.tearDown(self)
2199 2187
2200 2188
2201 class HelperFunctionTests(unittest.TestCase): 2189 class HelperFunctionTests(unittest.TestCase):
2202 @unittest.skipIf(mswindows, "errno and EINTR make no sense on windows") 2190 @unittest.skipIf(mswindows, "errno and EINTR make no sense on windows")
2203 def test_eintr_retry_call(self): 2191 def test_eintr_retry_call(self):
2204 record_calls = [] 2192 record_calls = []
2205 def fake_os_func(*args): 2193 def fake_os_func(*args):
2206 record_calls.append(args) 2194 record_calls.append(args)
2207 if len(record_calls) == 2: 2195 if len(record_calls) == 2:
2208 raise OSError(errno.EINTR, "fake interrupted system call") 2196 raise OSError(errno.EINTR, "fake interrupted system call")
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 stdout=subprocess.PIPE, 2285 stdout=subprocess.PIPE,
2298 stderr=subprocess.PIPE) as proc: 2286 stderr=subprocess.PIPE) as proc:
2299 pass 2287 pass
2300 2288
2301 2289
2302 def test_main(): 2290 def test_main():
2303 unit_tests = (ProcessTestCase, 2291 unit_tests = (ProcessTestCase,
2304 POSIXProcessTestCase, 2292 POSIXProcessTestCase,
2305 Win32ProcessTestCase, 2293 Win32ProcessTestCase,
2306 CommandTests, 2294 CommandTests,
2307 ProcessTestCaseNoPoll,
2308 HelperFunctionTests, 2295 HelperFunctionTests,
2309 CommandsWithSpaces, 2296 CommandsWithSpaces,
2310 ContextManagerTests, 2297 ContextManagerTests,
2311 ) 2298 )
2312 2299
2313 support.run_unittest(*unit_tests) 2300 support.run_unittest(*unit_tests)
2314 support.reap_children() 2301 support.reap_children()
2315 2302
2316 if __name__ == "__main__": 2303 if __name__ == "__main__":
2317 unittest.main() 2304 unittest.main()
OLDNEW
« Lib/subprocess.py ('K') | « Lib/subprocess.py ('k') | no next file » | no next file with comments »

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