[GRASS-SVN] r61222 - sandbox/wenzeslaus/gunittest

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 9 14:01:57 PDT 2014


Author: wenzeslaus
Date: 2014-07-09 14:01:57 -0700 (Wed, 09 Jul 2014)
New Revision: 61222

Removed:
   sandbox/wenzeslaus/gunittest/suite.py
Modified:
   sandbox/wenzeslaus/gunittest/loader.py
Log:
gunittest: custom test suite class is not needed if we invoke separate files as separate processes and allow them to fail with any error

Modified: sandbox/wenzeslaus/gunittest/loader.py
===================================================================
--- sandbox/wenzeslaus/gunittest/loader.py	2014-07-09 20:54:01 UTC (rev 61221)
+++ sandbox/wenzeslaus/gunittest/loader.py	2014-07-09 21:01:57 UTC (rev 61222)
@@ -18,9 +18,7 @@
 import collections
 import importlib
 
-from .suite import TestSuite
 
-
 GrassTestPythonModule = collections.namedtuple('GrassTestPythonModule',
                                                ['name', 'module',
                                                 'tested_dir',
@@ -82,12 +80,12 @@
                     # see unittest.loader
     return modules
 
+
 class GrassTestLoader(unittest.TestLoader):
 
     skip_dirs = ['.svn', 'dist.*', 'bin.*', 'OBJ.*']
     testsuite_dir = 'testsuite'
     files_in_testsuite = '*.py'
-    suiteClass = TestSuite
     all_tests_value = 'all'
     universal_tests_value = 'universal'
 

Deleted: sandbox/wenzeslaus/gunittest/suite.py
===================================================================
--- sandbox/wenzeslaus/gunittest/suite.py	2014-07-09 20:54:01 UTC (rev 61221)
+++ sandbox/wenzeslaus/gunittest/suite.py	2014-07-09 21:01:57 UTC (rev 61222)
@@ -1,51 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import unittest
-
-
-# TODO: this is not necessary if we handle separate files as separate processes
-class TestSuite(unittest.TestSuite):
-
-    def run(self, result, debug=False):
-        """
-
-        Original function implementation taken from Python's ``unittest.suite``.
-        """
-        topLevel = False
-        if getattr(result, '_testRunEntered', False) is False:
-            result._testRunEntered = topLevel = True
-
-        for test in self:
-            if result.shouldStop:
-                break
-
-            if _isnotsuite(test):
-                self._tearDownPreviousClass(test, result)
-                self._handleModuleFixture(test, result)
-                self._handleClassSetUp(test, result)
-                result._previousTestClass = test.__class__
-
-                if (getattr(test.__class__, '_classSetupFailed', False) or
-                   getattr(result, '_moduleSetUpFailed', False)):
-                    continue
-
-            if not debug:
-                test(result)
-            else:
-                test.debug()
-
-        if topLevel:
-            self._tearDownPreviousClass(None, result)
-            self._handleModuleTearDown(result)
-            result._testRunEntered = False
-        return result
-
-
-# helper from unittest.suite for the original implementation of run
-def _isnotsuite(test):
-    "A crude way to tell apart testcases and suites with duck-typing"
-    try:
-        iter(test)
-    except TypeError:
-        return True
-    return False



More information about the grass-commit mailing list