Back to index

python3.2  3.2.2
Public Member Functions
test.test_subprocess.CommandTests Class Reference

List of all members.

Public Member Functions

def test_getoutput

Detailed Description

Definition at line 1508 of file test_subprocess.py.


Member Function Documentation

Definition at line 1509 of file test_subprocess.py.

01509 
01510     def test_getoutput(self):
01511         self.assertEqual(subprocess.getoutput('echo xyzzy'), 'xyzzy')
01512         self.assertEqual(subprocess.getstatusoutput('echo xyzzy'),
01513                          (0, 'xyzzy'))
01514 
01515         # we use mkdtemp in the next line to create an empty directory
01516         # under our exclusive control; from that, we can invent a pathname
01517         # that we _know_ won't exist.  This is guaranteed to fail.
01518         dir = None
01519         try:
01520             dir = tempfile.mkdtemp()
01521             name = os.path.join(dir, "foo")
01522 
01523             status, output = subprocess.getstatusoutput('cat ' + name)
01524             self.assertNotEqual(status, 0)
01525         finally:
01526             if dir is not None:
01527                 os.rmdir(dir)
01528 
01529 
01530 @unittest.skipUnless(getattr(subprocess, '_has_poll', False),
                     "poll system call not supported")

Here is the call graph for this function:


The documentation for this class was generated from the following file: