Ejemplo n.º 1
0
 def test_tb_is_rendered(self):
     sys.stderr = StringIO.StringIO()
     errors = iter([[get_tb(), ]])
     std = StdOutput(mock.sentinel.test_result, mock.sentinel.args)
     std._print_tb(errors)
     sys.stderr.seek(0)
     out = sys.stderr.read()
     self.assertTrue('Exception' in out)
     self.assertTrue('Error message' in out)
Ejemplo n.º 2
0
 def test_add_error(self):
     exc = get_tb()
     self.relay.addError(mock.sentinel.test, exc,
                         mock.sentinel.loads_status)
     self.relay.push.assert_called_with(
         'addError',
         test='sentinel.test',
         exc_info=("<type 'exceptions.Exception'>", '', ''),
         loads_status=mock.sentinel.loads_status)
Ejemplo n.º 3
0
    def test_add_error(self):
        exc = get_tb()
        __, __, tb = exc
        string_tb = StringIO()
        traceback.print_tb(tb, file=string_tb)
        string_tb.seek(0)

        self.relay.addError(mock.sentinel.test, exc,
                            mock.sentinel.loads_status)
        self.relay.push.assert_called_with(
            'addError',
            test='sentinel.test',
            exc_info=("<type 'exceptions.Exception'>", '', string_tb.read()),
            loads_status=mock.sentinel.loads_status)
Ejemplo n.º 4
0
    def test_add_error(self):
        exc = get_tb()
        __, __, tb = exc
        string_tb = StringIO()
        traceback.print_tb(tb, file=string_tb)
        string_tb.seek(0)

        self.relay.addError(mock.sentinel.test, exc,
                            mock.sentinel.loads_status)
        self.relay.push.assert_called_with(
            'addError',
            test='sentinel.test',
            exc_info=("<type 'exceptions.Exception'>", 'Error message',
                      string_tb.read()),
            loads_status=mock.sentinel.loads_status)
Ejemplo n.º 5
0
    def test_add_error(self):
        exc = get_tb()
        __, __, tb = exc
        string_tb = StringIO()
        traceback.print_tb(tb, file=string_tb)
        string_tb.seek(0)

        self.relay.addError(mock.sentinel.test, exc, str(mock.sentinel.loads_status))

        recv = json.loads(self._pull.recv())
        self.assertEqual(recv["loads_status"], str(mock.sentinel.loads_status))
        self.assertEqual(recv["test"], str(mock.sentinel.test))
        exc_info = ["<type 'exceptions.Exception'>", "Error message", string_tb.read()]

        self.assertEqual(recv["exc_info"], exc_info)
Ejemplo n.º 6
0
    def test_add_error(self):
        exc = get_tb()
        __, __, tb = exc
        string_tb = StringIO()
        traceback.print_tb(tb, file=string_tb)
        string_tb.seek(0)

        self.relay.addError(mock.sentinel.test, exc,
                            str(mock.sentinel.loads_status))

        recv = json.loads(self._pull.recv())
        self.assertEqual(recv['loads_status'], str(mock.sentinel.loads_status))
        self.assertEqual(recv['test'], str(mock.sentinel.test))
        exc_info = [
            "<type 'exceptions.Exception'>", 'Error message',
            string_tb.read()
        ]

        self.assertEqual(recv['exc_info'], exc_info)