Lines Matching refs:Popen

107 class PopenExecuteChildRaises(subprocess.Popen):
108 """Popen subclass for testing cleanup of subprocess.PIPE filehandles when
118 p = subprocess.Popen(ZERO_RETURN_CMD,
132 p = subprocess.Popen(ZERO_RETURN_CMD,
297 # Popen() called with invalid arguments should raise TypeError
298 # but Popen.__del__ should not complain (issue #12085)
300 self.assertRaises(TypeError, subprocess.Popen, invalid_arg_name=1)
301 argcount = subprocess.Popen.__init__.__code__.co_argcount
303 self.assertRaises(TypeError, subprocess.Popen, *too_many_args)
308 p = subprocess.Popen([sys.executable, "-c", 'print("banana")'],
326 code = ('import sys; from subprocess import Popen, PIPE;'
327 'p = Popen([sys.executable, "-c", "print(\'test_stdout_none\')"],'
330 p = subprocess.Popen([sys.executable, "-c", code],
340 p = subprocess.Popen([sys.executable, "-c", 'print("banana")'],
351 p = subprocess.Popen(args, **kwargs)
360 # of args[0] to be valid for the Popen() call to Python to succeed.
420 # Invoke Python via Popen, and assert that (1) the call succeeds,
423 p = subprocess.Popen([python_arg, "-c",
456 # Check that Popen looks for args[0] relative to cwd if args[0]
463 self.assertRaises(FileNotFoundError, subprocess.Popen,
465 self.assertRaises(FileNotFoundError, subprocess.Popen,
472 # Check that Popen looks for executable relative to cwd if executable
480 self.assertRaises(FileNotFoundError, subprocess.Popen,
482 self.assertRaises(FileNotFoundError, subprocess.Popen,
490 # Check that Popen can find the executable when the cwd is wrong
498 self.assertRaises(FileNotFoundError, subprocess.Popen,
523 p = subprocess.Popen([sys.executable, "-c",
538 p = subprocess.Popen([sys.executable, "-c",
550 p = subprocess.Popen([sys.executable, "-c",
558 p = subprocess.Popen([sys.executable, "-c",
569 p = subprocess.Popen([sys.executable, "-c",
580 p = subprocess.Popen([sys.executable, "-c",
589 p = subprocess.Popen([sys.executable, "-c",
600 p = subprocess.Popen([sys.executable, "-c",
611 p = subprocess.Popen([sys.executable, "-c",
624 p = subprocess.Popen([sys.executable, "-c",
641 p = subprocess.Popen([sys.executable, "-c",
655 p = subprocess.Popen([sys.executable, "-c",
677 p = subprocess.Popen([sys.executable, "-c", code],
686 p = subprocess.Popen([sys.executable, "-c",
694 p = subprocess.Popen([sys.executable, "-c",
703 p = subprocess.Popen([sys.executable, "-c",
724 p = subprocess.Popen(
749 p = subprocess.Popen(
778 with subprocess.Popen([sys.executable, "-c",
807 with subprocess.Popen([sys.executable, "-c",
821 subprocess.Popen([cmd, "-c", "pass"])
825 subprocess.Popen([sys.executable, "-c", "pass#\0"])
832 subprocess.Popen(ZERO_RETURN_CMD, env=newenv)
838 subprocess.Popen(ZERO_RETURN_CMD, env=newenv)
844 subprocess.Popen(ZERO_RETURN_CMD, env=newenv)
849 with subprocess.Popen([sys.executable, "-c",
858 p = subprocess.Popen([sys.executable, "-c",
866 p = subprocess.Popen([sys.executable, "-c",
874 p = subprocess.Popen([sys.executable, "-c",
882 p = subprocess.Popen([sys.executable, "-c",
897 p = subprocess.Popen([sys.executable, "-c",
917 p = subprocess.Popen([sys.executable, "-c",
945 p = subprocess.Popen(ZERO_RETURN_CMD, **options)
956 p = subprocess.Popen([sys.executable, "-c",
969 p = subprocess.Popen([sys.executable, "-c",
987 p = subprocess.Popen([sys.executable, "-c",
1023 p = subprocess.Popen(args, **{'stdin': subprocess.PIPE,
1042 p = subprocess.Popen([sys.executable, "-c",
1067 p = subprocess.Popen([sys.executable, "-c",
1084 p = subprocess.Popen(ZERO_RETURN_CMD,
1093 p = subprocess.Popen([sys.executable, "-c",
1134 popen = subprocess.Popen(args,
1154 popen = subprocess.Popen(args,
1188 p = subprocess.Popen([sys.executable, "-c",
1220 p = subprocess.Popen([sys.executable, "-c",
1231 p = subprocess.Popen(ZERO_RETURN_CMD)
1237 p = subprocess.Popen([sys.executable,
1248 subprocess.Popen(ZERO_RETURN_CMD, "orange")
1252 p = subprocess.Popen(ZERO_RETURN_CMD, None)
1255 p = subprocess.Popen(ZERO_RETURN_CMD, bufsize=None)
1260 with subprocess.Popen([sys.executable, "-c", "import sys;"
1294 # see bug #5179: Popen leaks file descriptors to PIPEs if
1301 subprocess.Popen(NONEXISTING_CMD,
1306 # bpo-30121: Popen with pipes must close properly pipes on error.
1331 subprocess.Popen(cmd,
1338 proc = subprocess.Popen(cmd,
1357 subprocess.Popen(NONEXISTING_CMD,
1376 """Issue21291: Popen.wait() needs to be threadsafe for returncode."""
1377 proc = subprocess.Popen([sys.executable, '-c',
1445 subprocess.Popen (["*"], stdin=ifhandle, stdout=ofhandle,
1460 p = subprocess.Popen(ZERO_RETURN_CMD,
1474 ("ls", True, 123, "<Popen: returncode: 123 args: 'ls'>"),
1476 "<Popen: returncode: 0 args: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...>"),
1477 (["ls"], False, None, "<Popen: returncode: None args: ['ls']>"),
1479 "<Popen: returncode: None args: ['ls', '--my-opts', 'aaaaaaaaaaaaaaaaaaaaaaaa...>"),
1480 (path_cmd, False, 7, f"<Popen: returncode: 7 args: {pathlib_cls}('my-tool.py')>")
1482 with unittest.mock.patch.object(subprocess.Popen, '_execute_child'):
1484 p = subprocess.Popen(cmd, shell=shell)
1490 p = subprocess.Popen(ZERO_RETURN_CMD,
1514 with subprocess.Popen(args, **kw) as process:
1548 subprocess.Popen(['exit', '0'], cwd='/some/nonexistent/directory')
1552 self.assertIsInstance(subprocess.Popen[bytes], types.GenericAlias)
1795 p = subprocess.Popen([sys.executable, "-c", ""],
1810 p = subprocess.Popen([sys.executable, "-c", ""],
1825 p = subprocess.Popen([self._nonexistent_dir, "-c", ""])
1835 # We mock the __del__ method for Popen in the next two tests
1842 class PopenNoDestructor(subprocess.Popen):
2126 p = subprocess.Popen([sys.executable, "-c",
2155 p = subprocess.Popen([sys.executable, "-c",
2167 p = subprocess.Popen([sys.executable, "-c", ""],
2179 class _TestExecuteChildPopen(subprocess.Popen):
2183 subprocess.Popen.__init__(self, *args, **kwargs)
2187 subprocess.Popen._execute_child(self, *args, **kwargs)
2190 # none of them are the same as the ones the Popen
2228 "Popen enabled gc when it shouldn't.")
2234 self.assertTrue(gc.isenabled(), "Popen left gc disabled.")
2270 p = subprocess.Popen(fname)
2290 p = subprocess.Popen(["echo $FRUIT"], shell=1,
2300 p = subprocess.Popen("echo $FRUIT", shell=1,
2334 p = subprocess.Popen("echo $0", executable=sh, shell=True,
2346 p = subprocess.Popen([sys.executable, "-c", """if 1:
2369 p = subprocess.Popen([sys.executable, "-c", """if 1:
2442 out, err = subprocess.Popen([sys.executable, "-c",
2479 """Issue #15798: Popen should work when stdio fds are available."""
2489 subprocess.Popen([
2522 p = subprocess.Popen([sys.executable, "-c",
2566 p = subprocess.Popen([sys.executable, "-c",
2728 p1 = subprocess.Popen([sys.executable, sleeper],
2734 p2 = subprocess.Popen([sys.executable, fd_status],
2754 p1 = subprocess.Popen([sys.executable, qcat],
2758 p2 = subprocess.Popen([sys.executable, qgrep, subdata],
2805 p = subprocess.Popen([sys.executable, fd_status],
2813 p = subprocess.Popen([sys.executable, fd_status],
2825 p = subprocess.Popen([sys.executable, fd_status],
2854 p = subprocess.Popen([sys.executable, '-c', textwrap.dedent(
2891 subprocess.Popen(
2895 subprocess.Popen([sys.executable, %r] +
2934 p = subprocess.Popen([sys.executable, fd_status],
2965 p = subprocess.Popen(args,
2997 with subprocess.Popen([sys.executable, fd_status],
3011 p = subprocess.Popen(ZERO_RETURN_CMD,
3017 p = subprocess.Popen(ZERO_RETURN_CMD,
3023 p = subprocess.Popen(ZERO_RETURN_CMD,
3031 p = subprocess.Popen([sys.executable, sigchild_ignore],
3042 p = subprocess.Popen([sys.executable, "-c",
3056 # Issue #12650: on Unix, if Popen.__del__() was called before the
3059 # spawn a Popen, and delete its reference before it exits
3060 p = subprocess.Popen([sys.executable, "-c",
3080 # Issue #12650: on Unix, if Popen.__del__() was called before the
3084 # spawn a Popen, delete its reference and kill it
3085 p = subprocess.Popen([sys.executable, "-c",
3106 # let some time for the process to exit, and create a new Popen: this
3110 with subprocess.Popen(NONEXISTING_CMD,
3130 p = subprocess.Popen([sys.executable, fd_status],
3224 proc = subprocess.Popen(ZERO_RETURN_CMD)
3233 proc = subprocess.Popen(ZERO_RETURN_CMD)
3243 proc = subprocess.Popen([sys.executable, '-h'],
3258 proc = subprocess.Popen([sys.executable, '-h'],
3273 proc = subprocess.Popen(args)
3287 proc = subprocess.Popen(ZERO_RETURN_CMD)
3289 # wait until the process completes without using the Popen APIs.
3303 # so Popen failed to read it and uses a default returncode instead.
3309 p = subprocess.Popen([sys.executable, '-c', 'exit(1)'])
3321 proc = subprocess.Popen([sys.executable, '-c',
3367 # bpo-34044: Popen must not modify input STARTUPINFO structure
3372 # Call Popen() twice with the same startupinfo object to make sure
3377 proc = subprocess.Popen(cmd,
3410 # There shouldn't be an assertion failure in Popen() in case the env
3415 subprocess.Popen(ZERO_RETURN_CMD, env=BadEnv())
3436 p = subprocess.Popen([sys.executable, "-c",
3443 p = subprocess.Popen([sys.executable, "-c",
3454 p = subprocess.Popen([sys.executable, "-c",
3467 p = subprocess.Popen([sys.executable, "-c",
3490 p = subprocess.Popen(["set"], shell=1,
3500 p = subprocess.Popen("set", shell=1,
3511 p = subprocess.Popen("set", shell=1,
3526 p = subprocess.Popen([sys.executable, "-c", """if 1:
3546 p = subprocess.Popen([sys.executable, "-c", """if 1:
3588 class RecordingPopen(subprocess.Popen):
3589 """A Popen that saves a reference to each instance for testing."""
3596 @mock.patch.object(subprocess.Popen, "_communicate")
3599 """Fake a SIGINT happening during Popen._communicate() and ._wait().
3609 with mock.patch.object(subprocess.Popen, "_wait") as mock__wait:
3613 with mock.patch.object(subprocess, "Popen",
3627 if call == mock.call(timeout=0.25): # from Popen.__init__
3648 with subprocess.Popen(*args, **kwargs) as unused_process:
3717 p = subprocess.Popen(*args, **kwargs)
3746 with subprocess.Popen([sys.executable, "-c",
3759 with subprocess.Popen([sys.executable, "-c",
3766 with subprocess.Popen([sys.executable, "-c",
3775 with subprocess.Popen(NONEXISTING_CMD,
3782 proc = subprocess.Popen(ZERO_RETURN_CMD,