Example #1
0
 def test_clean_commandline_error_exit_clean_exit(self, exc_type,
                                                  exit_value):
     with mock.patch.object(sys, 'exit') as mock_exit:
         with errors.clean_commandline_error_exit(exit_value=exit_value):
             raise exc_type()
     mock_exit.assert_called_once_with(exit_value)
Example #2
0
 def test_clean_commandline_error_exit_raise_non_allowed(
         self, exc_type, msg):
     with self.assertRaisesRegexp(exc_type, msg):
         with errors.clean_commandline_error_exit():
             raise exc_type(msg)