[Erp5-report] r42637 jm - /erp5/trunk/products/ERP5Type/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jan 24 20:24:52 CET 2011


Author: jm
Date: Mon Jan 24 20:24:52 2011
New Revision: 42637

URL: http://svn.erp5.org?rev=42637&view=rev
Log:
Simplify ERP5TypeTestCase proxy class

Modified:
    erp5/trunk/products/ERP5Type/tests/ERP5TypeLiveTestCase.py
    erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py

Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeLiveTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeLiveTestCase.py?rev=42637&r1=42636&r2=42637&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeLiveTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeLiveTestCase.py [utf8] Mon Jan 24 20:24:52 2011
@@ -35,7 +35,8 @@ from Testing.ZopeTestCase import PortalT
 from Products.CMFCore.utils import getToolByName
 from Products.ERP5Type.tests.ProcessingNodeTestCase import ProcessingNodeTestCase
 from Products.ERP5Type.Globals import get_request
-from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCaseMixin
+from Products.ERP5Type.tests.ERP5TypeTestCase import \
+  ERP5TypeTestCaseMixin, ERP5TypeTestCase
 from glob import glob
 import transaction
 
@@ -193,8 +194,8 @@ def runLiveTest(test_list, verbosity=1, 
     imp.load_module(test_name, test_file, test_path_name, test_description)
 
   TestRunner = backportUnittest.TextTestRunner
-  from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
-  getTransactionalVariable()['unit_test_type'] = 'live_test'
+  if ERP5TypeLiveTestCase not in ERP5TypeTestCase.__bases__:
+    ERP5TypeTestCase.__bases__ = ERP5TypeLiveTestCase,
   if kw.get('debug', False):
     class DebugTextTestRunner(TestRunner):
       def _makeResult(self):

Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=42637&r1=42636&r2=42637&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] Mon Jan 24 20:24:52 2011
@@ -274,7 +274,7 @@ def profile_if_environ(environment_var_n
       # No profiling, return identity decorator
       return lambda self, method: method
 
-class ERP5TypeTestCaseMixin(object):
+class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
     """Mixin class for ERP5 based tests.
     """
 
@@ -629,7 +629,7 @@ class ERP5TypeTestCaseMixin(object):
 
         return ResponseWrapper(response, outstream, path)
 
-class ERP5TypeCommandLineTestCase(object):
+class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
 
     def getPortalName(self):
       """
@@ -1093,28 +1093,12 @@ class ERP5TypeCommandLineTestCase(object
       obj.manage_afterClone(obj)
       return obj
 
-class ERP5TypeTestCase(ERP5TypeTestCaseMixin):
+class ERP5TypeTestCase(ERP5TypeCommandLineTestCase):
     """TestCase for ERP5 based tests.
 
     This TestCase setups an ERP5Site and installs business templates.
     """
 
-    def __init__(self, *args, **kw):
-      type_test_case_klass = ERP5TypeCommandLineTestCase
-      from Products.ERP5Type.TransactionalVariable import \
-            getTransactionalVariable
-      unit_test_type = getTransactionalVariable().get('unit_test_type', None)
-      if unit_test_type == 'live_test':
-        from Products.ERP5Type.tests.ERP5TypeLiveTestCase import \
-                ERP5TypeLiveTestCase
-        type_test_case_klass = ERP5TypeLiveTestCase
-      klass = self.__class__
-      class TempTestCase(klass, type_test_case_klass,
-              ProcessingNodeTestCase, PortalTestCase):
-        pass
-      self.__class__ = TempTestCase
-      return PortalTestCase.__init__(self, *args, **kw)
-
 from Products.ERP5 import ERP5Site
 ERP5Site.getBootstrapBusinessTemplateUrl = lambda bt_title: \
   ERP5TypeCommandLineTestCase._getBTPathAndIdList((bt_title,))[0][0]



More information about the Erp5-report mailing list