Commit 74d0df27 authored by Julien Muchembled's avatar Julien Muchembled

Simplify ERP5TypeTestCase proxy class

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42637 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1a4290a5
No related merge requests found
......@@ -35,7 +35,8 @@ from Testing.ZopeTestCase import PortalTestCase, user_name
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, stream=None, **kw):
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):
......
......@@ -274,7 +274,7 @@ def profile_if_environ(environment_var_name):
# 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]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment