MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_getoutput

Method test_getoutput

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

Source from the content-addressed store, hash-verified

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