Пример #1
0
 def test_repr(self):
     """repr contains output, error and code"""
     procerr = shell.ProcessError(13, "myout42", "myerr42")
     stringified = repr(procerr)
     self.assertIn('13', stringified)
     self.assertIn('myout42', stringified)
     self.assertIn('myerr42', stringified)
Пример #2
0
 def test_trace(self):
     """traceback has args"""
     try:
         raise shell.ProcessError(13, "myout8080", "myerr8080")
     except shell.ProcessError:
         trace = traceback.format_exc()
     stringified = trace.splitlines()[-2]
     self.assertIn('13', stringified)
     self.assertIn('myout8080', stringified)
     self.assertIn('myerr8080', stringified)
Пример #3
0
 def test_failure(self):
     """autoexit_code wrapping a ProcessError raise exits"""
     with self.assertRaises(SystemExit):
         with shell.autoexit_code():
             raise shell.ProcessError(13)
Пример #4
0
 def test_output(self):
     """output attribtue is set to passed-in value"""
     self.assertEqual(shell.ProcessError(13, "woo").output, "woo")
Пример #5
0
 def test_returncode(self):
     """returncode attribtue is set to passed-in value"""
     self.assertEqual(shell.ProcessError(13).returncode, 13)