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

Method test_args_string

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

Source from the content-addressed store, hash-verified

2486 self.skipTest('RLIMIT_NPROC had no effect; probably superuser')
2487
2488 def test_args_string(self):
2489 # args is a string
2490 fd, fname = tempfile.mkstemp()
2491 # reopen in text mode
2492 with open(fd, "w", errors="surrogateescape") as fobj:
2493 fobj.write("#!%s\n" % support.unix_shell)
2494 fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
2495 sys.executable)
2496 os.chmod(fname, 0o700)
2497 p = subprocess.Popen(fname)
2498 p.wait()
2499 os.remove(fname)
2500 self.assertEqual(p.returncode, 47)
2501
2502 def test_invalid_args(self):
2503 # invalid arguments should raise ValueError

Callers

nothing calls this directly

Calls 6

waitMethod · 0.95
openFunction · 0.50
writeMethod · 0.45
chmodMethod · 0.45
removeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected