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

Method test_getoutput

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

Source from the content-addressed store, hash-verified

3952 self._test_keyboardinterrupt_no_kill(popen_via_context_manager)
3953
3954 def test_getoutput(self):
3955 self.assertEqual(subprocess.getoutput('echo xyzzy'), 'xyzzy')
3956 self.assertEqual(subprocess.getstatusoutput('echo xyzzy'),
3957 (0, 'xyzzy'))
3958
3959 # we use mkdtemp in the next line to create an empty directory
3960 # under our exclusive control; from that, we can invent a pathname
3961 # that we _know_ won't exist. This is guaranteed to fail.
3962 dir = None
3963 try:
3964 dir = tempfile.mkdtemp()
3965 name = os.path.join(dir, "foo")
3966 status, output = subprocess.getstatusoutput(
3967 ("type " if mswindows else "cat ") + name)
3968 self.assertNotEqual(status, 0)
3969 finally:
3970 if dir is not None:
3971 os.rmdir(dir)
3972
3973 def test__all__(self):
3974 """Ensure that __all__ is populated properly."""

Callers

nothing calls this directly

Calls 5

mkdtempMethod · 0.80
assertNotEqualMethod · 0.80
rmdirMethod · 0.80
assertEqualMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected