[GRASS-SVN] r60730 - sandbox/wenzeslaus/gunittest
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 6 14:13:15 PDT 2014
Author: wenzeslaus
Date: 2014-06-06 14:13:15 -0700 (Fri, 06 Jun 2014)
New Revision: 60730
Modified:
sandbox/wenzeslaus/gunittest/case.py
Log:
gunittest: few experimental lines for basic code coverage (coverage package)
Modified: sandbox/wenzeslaus/gunittest/case.py
===================================================================
--- sandbox/wenzeslaus/gunittest/case.py 2014-06-06 17:46:12 UTC (rev 60729)
+++ sandbox/wenzeslaus/gunittest/case.py 2014-06-06 21:13:15 UTC (rev 60730)
@@ -1,19 +1,48 @@
# -*- coding: utf-8 -*-
+"""!@package grass.gunittest.case
+
+ at brief GRASS Python testing framework test case
+
+(C) 2014 by the GRASS Development Team
+This program is free software under the GNU General Public
+License (>=v2). Read the file COPYING that comes with GRASS
+for details.
+
+ at author Vaclav Petras
+"""
+
+
import unittest
from unittest.util import safe_repr
from .checkers import check_text_ellipsis
+
class GrassTestCase(unittest.TestCase):
-
+
def assertLooksLike(self, actual, reference, msg=None):
self.assert_(isinstance(actual, basestring), (
- 'actual argument is not a string'))
+ 'actual argument is not a string'))
self.assert_(isinstance(reference, basestring), (
- 'reference argument is not a string'))
+ 'reference argument is not a string'))
if not check_text_ellipsis(actual=actual, reference=reference):
standardMsg = self._formatMessage(msg, '"%s" does not correspond with "%s"'
% (safe_repr(actual),
safe_repr(reference)))
self.fail(self._formatMessage(msg, standardMsg))
+
+
+# the following lines are for code coverage
+import coverage
+cov = coverage.coverage(omit="*testsuite*")
+cov.start()
+
+
+def endcov(cov):
+ cov.stop()
+ cov.html_report(directory='testcodecoverage')
+
+
+import atexit
+atexit.register(endcov, cov)
More information about the grass-commit
mailing list