Просмотр исходного кода

gunittest: fix inconsistent test counts (test report not created because of diving by zero (total=0))

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@61631 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 10 лет назад
Родитель
Сommit
f9d2e72710
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      lib/python/gunittest/runner.py

+ 8 - 0
lib/python/gunittest/runner.py

@@ -266,6 +266,14 @@ class KeyValueTestResult(TestResult):
 
         status = 'succeeded' if self.wasSuccessful() else 'failed'
         infos.append("status=%s" % status)
+
+        # if only errors occur, tests are not counted properly
+        # in unittest, so reconstruct their count here
+        # (using general equation, although now errors would be enough)
+        # alternative is to behave as failed file, i.e. do not
+        # write test details and just write status=failed
+        if not run:
+            run = errors + failed + succeeded
         infos.append("total=%d" % (run))
 
         infos.append("failures=%d" % failed)