Exemplo n.º 1
0
    def test_exception_handler(self):
        try:
            self.assertTrue(False)
        except Exception:
            exc_info = sys.exc_info()
        with mock.patch('traceback.print_exception') as mock_print_exception:
            with mock.patch('pdb.post_mortem') as mock_post_mortem:
                with mock.patch.object(post_mortem_debug,
                                       'get_ignored_traceback',
                                       return_value=mock.Mock()):
                    post_mortem_debug.exception_handler(exc_info)

        mock_print_exception.called_once_with(*exc_info)
        mock_post_mortem.called_once()
Exemplo n.º 2
0
    def test_exception_handler(self):
        try:
            self.assertTrue(False)
        except Exception:
            exc_info = sys.exc_info()
        with mock.patch('traceback.print_exception') as mock_print_exception:
            with mock.patch('pdb.post_mortem') as mock_post_mortem:
                with mock.patch.object(post_mortem_debug,
                                       'get_ignored_traceback',
                                       return_value=mock.Mock()):
                    post_mortem_debug.exception_handler(exc_info)

        mock_print_exception.called_once_with(*exc_info)
        mock_post_mortem.called_once()
Exemplo n.º 3
0
    def test_exception_handler(self):
        try:
            self.assertTrue(False)
        except Exception:
            exc_info = sys.exc_info()
        with mock.patch('traceback.print_exception') as mock_print_exception:
            with mock.patch('pdb.post_mortem') as mock_post_mortem:
                with mock.patch.object(post_mortem_debug,
                                       'get_ignored_traceback',
                                       return_value=mock.Mock()):
                    post_mortem_debug.exception_handler(exc_info)

        # traceback will become post_mortem_debug.FilteredTraceback
        filtered_exc_info = (exc_info[0], exc_info[1], mock.ANY)
        mock_print_exception.assert_called_once_with(*filtered_exc_info)
        mock_post_mortem.assert_called_once_with(mock.ANY)
Exemplo n.º 4
0
    def test_exception_handler(self):
        try:
            self.assertTrue(False)
        except Exception:
            exc_info = sys.exc_info()
        with mock.patch('traceback.print_exception') as mock_print_exception:
            with mock.patch('pdb.post_mortem') as mock_post_mortem:
                with mock.patch.object(post_mortem_debug,
                                       'get_ignored_traceback',
                                       return_value=mock.Mock()):
                    post_mortem_debug.exception_handler(exc_info)

        # traceback will become post_mortem_debug.FilteredTraceback
        filtered_exc_info = (exc_info[0], exc_info[1], mock.ANY)
        mock_print_exception.assert_called_once_with(*filtered_exc_info)
        mock_post_mortem.assert_called_once_with(mock.ANY)