Esempio n. 1
0
 def test_classnames_strings_are_used_when_available(self):
     sys.stderr = StringIO.StringIO()
     std = StdOutput(mock.sentinel.test_result, mock.sentinel.args)
     std._print_tb(iter([[['foo', 'foobar', None]]]))
     sys.stderr.seek(0)
     out = sys.stderr.read()
     self.assertTrue('foo: foobar' in out)
Esempio n. 2
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)
Esempio n. 3
0
    def test_std(self):
        sys.stdout = StringIO.StringIO()

        test_result = FakeTestResult()
        std = StdOutput(test_result, {'total': 10})
        for i in range(11):
            test_result.nb_finished_tests += 1
            std.push('stopTest')
        std.flush()
        sys.stdout.seek(0)
        out = sys.stdout.read()
        self.assertTrue('Hits: 10' in out)
        self.assertTrue('100%' in out, out)
Esempio n. 4
0
 def test_counter(self):
     sys.stdout = StringIO.StringIO()
     test_result = FakeTestResult()
     std = StdOutput(test_result, {'total': 10})
     for i in range(11):
         test_result.nb_finished_tests += 1
         std.push('stopTest')
     std.flush()
     sys.stdout.seek(0)
     out = sys.stdout.read()
     wanted = ['boo', '123']
     for item in wanted:
         self.assertTrue(item in out)
Esempio n. 5
0
 def test_url_output(self):
     sys.stdout = StringIO.StringIO()
     test_result = FakeTestResult()
     std = StdOutput(test_result, {'total': 10})
     for i in range(11):
         test_result.nb_finished_tests += 1
         std.push('stopTest')
     std.flush()
     sys.stdout.seek(0)
     out = sys.stdout.read()
     wanted = ['http://baz', 'Average request time: 12.34',
               'Hits success rate: 2.0', 'http://foo',
               'Average request time: 1.234',
               'Hits success rate: 23.0']
     for item in wanted:
         self.assertTrue(item in out)
Esempio n. 6
0
 def test_errors_are_processed(self):
     test_result = FakeTestResult(nb_errors=1, nb_failures=1)
     std = StdOutput(test_result, {'total': 10})
     std._print_tb = mock.Mock()
     std.flush()
     self.assertEquals(2, std._print_tb.call_count)
Esempio n. 7
0
 def test_empty_tb_is_not_processed(self):
     std = StdOutput(mock.sentinel.test_result, mock.sentinel.args)
     std._print_tb(iter(([], [])))