Ejemplo n.º 1
0
 def test_logfile_not_found(self):
     os.unlink(self.logfile.name)
     with self.assertRaises(SystemExit) as cm:
         check_log(self.logfile.name)
     self.assertEqual(
         "[Errno 2] No such file or directory: "
         "'{}'".format(self.logfile.name),
         str(cm.exception))
Ejemplo n.º 2
0
 def test_logfile_without_score(self):
     with open(self.logfile.name, 'wt') as f:
         f.write('FurMark : init OK.\n')
         f.write('[No_Score] - module: FurMark - Score: _ points'
                 '(800x600 windowed, duration:2000 ms).')
     with patch('sys.stdout', self.devnull):
         with self.assertRaises(SystemExit) as cm:
             check_log(self.logfile.name)
         self.assertEqual(
             'Benchmark score not found, check the log for errors',
             str(cm.exception))
     os.unlink(self.logfile.name)
Ejemplo n.º 3
0
 def test_logfile_with_score(self):
     with open(self.logfile.name, 'wt') as f:
         f.write('FurMark : init OK.\n')
         f.write('[Benchmark_Score] - module: FurMark - Score: 8 points'
                 '(800x600 windowed, duration:2000 ms).')
     with patch('sys.stdout', self.devnull):
         self.assertFalse(check_log(self.logfile.name))
     os.unlink(self.logfile.name)
Ejemplo n.º 4
0
 def test_logfile_with_encoding_error(self):
     with open(self.logfile.name, 'wb') as f:
         f.write(b'\x80abc\n')
         f.write(b'FurMark : init OK.\n')
         f.write(b'[Benchmark_Score] - module: FurMark - Score: 116 points'
                 b'(800x600 windowed, duration:2000 ms).')
     with patch('sys.stdout', self.devnull):
         self.assertFalse(check_log(self.logfile.name))
     os.unlink(self.logfile.name)