[GRASS-SVN] r61631 - grass/trunk/lib/python/gunittest

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 14 08:27:51 PDT 2014


Author: wenzeslaus
Date: 2014-08-14 08:27:51 -0700 (Thu, 14 Aug 2014)
New Revision: 61631

Modified:
   grass/trunk/lib/python/gunittest/runner.py
Log:
gunittest: fix inconsistent test counts (test report not created because of diving by zero (total=0))

Modified: grass/trunk/lib/python/gunittest/runner.py
===================================================================
--- grass/trunk/lib/python/gunittest/runner.py	2014-08-14 15:18:41 UTC (rev 61630)
+++ grass/trunk/lib/python/gunittest/runner.py	2014-08-14 15:27:51 UTC (rev 61631)
@@ -266,6 +266,14 @@
 
         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)



More information about the grass-commit mailing list