Home | History | Annotate | Download | only in test

Lines Matching full:subprocess

3 import subprocess
48 for inst in subprocess._active:
50 subprocess._cleanup()
51 self.assertFalse(subprocess._active, "subprocess._active not empty")
65 class PopenExecuteChildRaises(subprocess.Popen):
66 """Popen subclass for testing cleanup of subprocess.PIPE filehandles when
77 rc = subprocess.call([sys.executable, "-c",
83 rc = subprocess.check_call([sys.executable, "-c",
89 with self.assertRaises(subprocess.CalledProcessError) as c:
90 subprocess.check_call([sys.executable, "-c",
96 output = subprocess.check_output(
102 with self.assertRaises(subprocess.CalledProcessError) as c:
103 subprocess.check_output(
109 output = subprocess.check_output(
111 stderr=subprocess.STDOUT)
117 output = subprocess.check_output(
127 rc = subprocess.call([sys.executable, "-c",
137 self.assertRaises(TypeError, subprocess.Popen, invalid_arg_name=1)
138 argcount = subprocess.Popen.__init__.__code__.co_argcount
140 self.assertRaises(TypeError, subprocess.Popen, *too_many_args)
145 p = subprocess.Popen([sys.executable, "-c", 'print "banana"'],
146 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
155 # subprocess in a subprocess:
157 # \-- subprocess created by this test (parent)
158 # \-- subprocess created by the parent subprocess (child)
163 code = ('import sys; from subprocess import Popen, PIPE;'
167 p = subprocess.Popen([sys.executable, "-c", code],
168 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
177 p = subprocess.Popen([sys.executable, "-c", 'print "banana"'],
178 stdin=subprocess.PIPE, stdout=subprocess.PIPE)
186 p = subprocess.Popen(["somethingyoudonthave", "-c",
197 p = subprocess.Popen(["somethingyoudonthave", "-c",
205 p = subprocess.Popen([sys.executable, "-c",
207 stdin=subprocess.PIPE)
219 p = subprocess.Popen([sys.executable, "-c",
230 p = subprocess.Popen([sys.executable, "-c",
238 p = subprocess.Popen([sys.executable, "-c",
240 stdout=subprocess.PIPE)
248 p = subprocess.Popen([sys.executable, "-c",
258 p = subprocess.Popen([sys.executable, "-c",
267 p = subprocess.Popen([sys.executable, "-c",
269 stderr=subprocess.PIPE)
277 p = subprocess.Popen([sys.executable, "-c",
287 p = subprocess.Popen([sys.executable, "-c",
296 p = subprocess.Popen([sys.executable, "-c",
301 stdout=subprocess.PIPE,
302 stderr=subprocess.STDOUT)
309 p = subprocess.Popen([sys.executable, "-c",
323 # test_stdout_none (see above). The parent subprocess calls the child
324 # subprocess passing stdout=1, and this test uses stdout=PIPE in
326 code = ('import sys, subprocess; '
327 'rc = subprocess.call([sys.executable, "-c", '
331 p = subprocess.Popen([sys.executable, "-c", code],
332 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
347 p = subprocess.Popen([sys.executable, "-c",
350 stdout=subprocess.PIPE,
359 p = subprocess.Popen([sys.executable, "-c",
362 stdout=subprocess.PIPE,
368 p = subprocess.Popen([sys.executable, "-c",
371 stdin=subprocess.PIPE)
376 p = subprocess.Popen([sys.executable, "-c",
378 stdout=subprocess.PIPE)
384 p = subprocess.Popen([sys.executable, "-c",
386 stderr=subprocess.PIPE)
392 p = subprocess.Popen([sys.executable, "-c",
396 stdin=subprocess.PIPE,
397 stdout=subprocess.PIPE,
398 stderr=subprocess.PIPE)
414 p = subprocess.Popen([sys.executable, "-c", "print()"],
415 stdout=subprocess.PIPE)
425 p = subprocess.Popen([sys.executable, "-c",
442 p = subprocess.Popen([sys.executable, "-c",
447 stdin=subprocess.PIPE,
448 stdout=subprocess.PIPE,
449 stderr=subprocess.PIPE)
459 p = subprocess.Popen([sys.executable, "-c",
462 stdin=subprocess.PIPE,
463 stdout=subprocess.PIPE,
464 stderr=subprocess.PIPE)
474 p = subprocess.Popen([sys.executable, "-c",
487 stdout=subprocess.PIPE,
502 p = subprocess.Popen([sys.executable, "-c",
515 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
548 # Close a couple of them (should be enough for a subprocess)
554 p = subprocess.Popen([sys.executable, "-c",
557 stdin=subprocess.PIPE,
558 stdout=subprocess.PIPE,
559 stderr=subprocess.PIPE)
568 self.assertEqual(subprocess.list2cmdline(['a b c', 'd', 'e']),
570 self.assertEqual(subprocess.list2cmdline(['ab"c', '\\', 'd']),
572 self.assertEqual(subprocess.list2cmdline(['ab"c', ' \\', 'd']),
574 self.assertEqual(subprocess.list2cmdline(['a\\\\\\b', 'de fg', 'h']),
576 self.assertEqual(subprocess.list2cmdline(['a\\"b', 'c', 'd']),
578 self.assertEqual(subprocess.list2cmdline(['a\\\\b c', 'd', 'e']),
580 self.assertEqual(subprocess.list2cmdline(['a\\\\b\\ c', 'd', 'e']),
582 self.assertEqual(subprocess.list2cmdline(['ab', '']),
587 p = subprocess.Popen([sys.executable,
603 p = subprocess.Popen([sys.executable,
614 subprocess.Popen([sys.executable, "-c", "pass"], "orange")
625 subprocess.Popen(['nonexisting_i_hope'],
626 stdout=subprocess.PIPE,
627 stderr=subprocess.PIPE)
639 subprocess.Popen (["*"], stdin=ifhandle, stdout=ofhandle,
654 p = subprocess.Popen([sys.executable, "-c", 'pass'],
655 stdin=subprocess.PIPE,
656 stdout=subprocess.PIPE,
657 stderr=subprocess.PIPE)
665 p = subprocess.Popen([sys.executable, "-c", 'pass'],
666 stdin=subprocess.PIPE)
681 [sys.executable, '-c', 'pass'], stdin=subprocess.PIPE,
682 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
713 value = subprocess.Popen(['/usr/bin/defaults', 'read',
715 stdout=subprocess.PIPE).communicate()[0]
742 kw = {stream: subprocess.PIPE}
743 with subprocess.Popen(args, **kw) as process:
755 p = subprocess.Popen([sys.executable, "-c", ""],
763 p = subprocess.Popen([sys.executable, "-c",
770 p = subprocess.Popen([sys.executable, "-c",
773 stdout=subprocess.PIPE,
778 class _TestExecuteChildPopen(subprocess.Popen):
782 subprocess.Popen.__init__(self, *args, **kwargs)
791 subprocess.Popen._execute_child(
821 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
822 stderr=subprocess.PIPE, preexec_fn=raise_it)
832 p = subprocess.Popen(fname)
839 self.assertRaises(ValueError, subprocess.call,
843 self.assertRaises(ValueError, subprocess.call,
852 p = subprocess.Popen(["echo $FRUIT"], shell=1,
853 stdout=subprocess.PIPE,
862 p = subprocess.Popen("echo $FRUIT", shell=1,
863 stdout=subprocess.PIPE,
876 rc = subprocess.call(fname)
895 p = subprocess.Popen("echo $0", executable=sh, shell=True,
896 stdout=subprocess.PIPE)
903 p = subprocess.Popen([sys.executable, "-c", """if 1:
910 stdin=subprocess.PIPE,
911 stdout=subprocess.PIPE,
912 stderr=subprocess.PIPE)
924 p = subprocess.Popen([sys.executable, "-c", """if 1:
930 stdin=subprocess.PIPE,
931 stdout=subprocess.PIPE,
932 stderr=subprocess.PIPE)
973 # Issue #9905: test that subprocess pipes still work properly with
985 out, err = subprocess.Popen([sys.executable, "-c",
991 stdout=subprocess.PIPE,
992 stderr=subprocess.PIPE).communicate()
1020 # Issue #10806: test that subprocess pipes still work properly with
1044 # now use those files in the given order, so that subprocess
1046 p = subprocess.Popen([sys.executable, "-c",
1086 p = subprocess.Popen([sys.executable, sigchild_ignore],
1087 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
1094 # process exited, it wouldn't be added to subprocess._active, and would
1097 p = subprocess.Popen([sys.executable, "-c",
1100 stdout=subprocess.PIPE,
1101 stderr=subprocess.PIPE)
1108 self.assertIn(ident, [id(o) for o in subprocess._active])
1113 # be removed from subprocess._active, which triggered a FD and memory
1116 p = subprocess.Popen([sys.executable, "-c",
1119 stdout=subprocess.PIPE,
1120 stderr=subprocess.PIPE)
1128 self.assertIn(ident, [id(o) for o in subprocess._active])
1134 with subprocess.Popen(['nonexisting_i_hope'],
1135 stdout=subprocess.PIPE,
1136 stderr=subprocess.PIPE) as proc:
1140 self.assertNotIn(ident, [id(o) for o in subprocess._active])
1145 p1 = subprocess.Popen([sys.executable, "-c",
1149 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
1150 stderr=subprocess.PIPE)
1152 p2 = subprocess.Popen([sys.executable, "-c", """if True:
1166 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
1167 stderr=subprocess.PIPE, close_fds=False)
1183 startupinfo = subprocess.STARTUPINFO()
1189 subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"],
1196 subprocess.call(sys.executable +
1202 self.assertRaises(ValueError, subprocess.call,
1206 self.assertRaises(ValueError, subprocess.call,
1209 stdout=subprocess.PIPE,
1214 rc = subprocess.call([sys.executable, "-c",
1223 p = subprocess.Popen(["set"], shell=1,
1224 stdout=subprocess.PIPE,
1233 p = subprocess.Popen("set", shell=1,
1234 stdout=subprocess.PIPE,
1241 rc = subprocess.call(sys.executable +
1247 p = subprocess.Popen([sys.executable, "-c", """if 1:
1253 stdin=subprocess.PIPE,
1254 stdout=subprocess.PIPE,
1255 stderr=subprocess.PIPE)
1269 p = subprocess.Popen([sys.executable, "-c", """if 1:
1275 stdin=subprocess.PIPE,
1276 stdout=subprocess.PIPE,
1277 stderr=subprocess.PIPE)
1312 @unittest.skipUnless(getattr(subprocess, '_has_poll', False),
1316 subprocess._has_poll = False
1320 subprocess._has_poll = True
1335 subprocess._eintr_retry_call(fake_os_func, 256, 999))
1339 subprocess._eintr_retry_call(fake_os_func, 666))
1359 kwargs['stdout'] = subprocess.PIPE
1360 p = subprocess.Popen(*args, **kwargs)