MCPcopy Index your code
hub / github.com/python/cpython / test_call_string

Method test_call_string

Lib/test/test_subprocess.py:2533–2544  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2531 self.assertEqual(p.stdout.read().strip(b" \t\r\n\f"), b"apple")
2532
2533 def test_call_string(self):
2534 # call() function with string argument on UNIX
2535 fd, fname = tempfile.mkstemp()
2536 # reopen in text mode
2537 with open(fd, "w", errors="surrogateescape") as fobj:
2538 fobj.write("#!%s\n" % support.unix_shell)
2539 fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
2540 sys.executable)
2541 os.chmod(fname, 0o700)
2542 rc = subprocess.call(fname)
2543 os.remove(fname)
2544 self.assertEqual(rc, 47)
2545
2546 def test_specific_shell(self):
2547 # Issue #9265: Incorrect name passed as arg[0].

Callers

nothing calls this directly

Calls 6

openFunction · 0.50
writeMethod · 0.45
chmodMethod · 0.45
callMethod · 0.45
removeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected