コード例 #1
0
ファイル: tr_test.py プロジェクト: tomtix/osux
 def check_same_len(self, res):
     if not self.expected:
         return
     if len(self.expected) != len(res):
         logging.error(Colors.fail("Incorrect list length"))
         logging.error("expected: %d" % (len(self.expected)))
         logging.error("got:      %d" % (len(res)))
         logging.error(str(self.expected))
         logging.error(str(res))
         raise TR_Exception("Incorrect list length")
コード例 #2
0
ファイル: tr_test.py プロジェクト: tomtix/osux
 def main(self):
     if not self.argv:
         logging.error("No test file!")
         return False
     #
     for arg in self.argv:
         try:
             logging.info(Colors.blue("Test on %s:" % arg))
             err, tot = self.test(arg)
             self._errors += err
             self._total  += tot
         except TR_Exception as e:
             logging.error(str(e))
     #
     logging.info("")
     if self._errors == 0:
         logging.error(Colors.green("All test files passed! %d/%d" %
                       (self._total - self._errors, self._total)))
     else:
         logging.error(Colors.fail("Some test files failed! %d/%d" %
                       (self._total - self._errors, self._total)))
     #
     return self._errors == 0;
コード例 #3
0
ファイル: tr_test.py プロジェクト: tomtix/osux
 def print_result(self, errors, total):
     args = (self.name, total - errors, total)
     if errors == 0:
         logging.warning(Colors.green("Test '%s' passed! %d/%d" % args))
     else:
         logging.warning(Colors.fail("Test '%s' failed! %d/%d" % args))