Esempio n. 1
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. 2
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. 3
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)