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

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

Issue 11659: Fix ResourceWarning in test_subprocess
Patch Set: Created 8 years, 3 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 | « no previous file | Misc/ACKS » ('j') | 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 support 2 from test import support
3 import subprocess 3 import subprocess
4 import sys 4 import sys
5 import signal 5 import signal
6 import io 6 import io
7 import os 7 import os
8 import errno 8 import errno
9 import tempfile 9 import tempfile
10 import time 10 import time
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 def test_select_unbuffered(self): 1318 def test_select_unbuffered(self):
1319 # Issue #11459: bufsize=0 should really set the pipes as 1319 # Issue #11459: bufsize=0 should really set the pipes as
1320 # unbuffered (and therefore let select() work properly). 1320 # unbuffered (and therefore let select() work properly).
1321 select = support.import_module("select") 1321 select = support.import_module("select")
1322 p = subprocess.Popen([sys.executable, "-c", 1322 p = subprocess.Popen([sys.executable, "-c",
1323 'import sys;' 1323 'import sys;'
1324 'sys.stdout.write("apple")'], 1324 'sys.stdout.write("apple")'],
1325 stdout=subprocess.PIPE, 1325 stdout=subprocess.PIPE,
1326 bufsize=0) 1326 bufsize=0)
1327 f = p.stdout 1327 f = p.stdout
1328 self.addCleanup(f.close)
1328 try: 1329 try:
1329 self.assertEqual(f.read(4), b"appl") 1330 self.assertEqual(f.read(4), b"appl")
1330 self.assertIn(f, select.select([f], [], [], 0.0)[0]) 1331 self.assertIn(f, select.select([f], [], [], 0.0)[0])
1331 finally: 1332 finally:
1332 p.wait() 1333 p.wait()
1333 1334
1334 1335
1335 @unittest.skipUnless(mswindows, "Windows specific tests") 1336 @unittest.skipUnless(mswindows, "Windows specific tests")
1336 class Win32ProcessTestCase(BaseTestCase): 1337 class Win32ProcessTestCase(BaseTestCase):
1337 1338
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 ProcessTestCaseNoPoll, 1602 ProcessTestCaseNoPoll,
1602 HelperFunctionTests, 1603 HelperFunctionTests,
1603 CommandsWithSpaces, 1604 CommandsWithSpaces,
1604 ContextManagerTests) 1605 ContextManagerTests)
1605 1606
1606 support.run_unittest(*unit_tests) 1607 support.run_unittest(*unit_tests)
1607 support.reap_children() 1608 support.reap_children()
1608 1609
1609 if __name__ == "__main__": 1610 if __name__ == "__main__":
1610 unittest.main() 1611 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | Misc/ACKS » ('j') | no next file with comments »

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