Commit ca01799d authored by Jean-Paul Smets's avatar Jean-Paul Smets

Use existing connection insteaed of a new one.

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@37678 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6b5a3477
...@@ -29,10 +29,14 @@ ...@@ -29,10 +29,14 @@
import unittest import unittest
import os import os
from Testing import ZopeTestCase
from Testing.ZopeTestCase import PortalTestCase, user_name from Testing.ZopeTestCase import PortalTestCase, user_name
from Products.ERP5Type.tests.ProcessingNodeTestCase import ProcessingNodeTestCase from Products.ERP5Type.tests.ProcessingNodeTestCase import ProcessingNodeTestCase
from Products.ERP5Type.Globals import get_request
import transaction import transaction
from zLOG import LOG, DEBUG, INFO
def profile_if_environ(environment_var_name): def profile_if_environ(environment_var_name):
if int(os.environ.get(environment_var_name, 0)): if int(os.environ.get(environment_var_name, 0)):
def decorator(self, method): def decorator(self, method):
...@@ -143,9 +147,15 @@ class ERP5TypeLiveTestCase(ProcessingNodeTestCase, PortalTestCase): ...@@ -143,9 +147,15 @@ class ERP5TypeLiveTestCase(ProcessingNodeTestCase, PortalTestCase):
self._setup() self._setup()
self.afterSetUp() self.afterSetUp()
except: except:
self.beforeClear()
self._clear() self._clear()
raise raise
def _app(self):
'''Returns the app object for a test.'''
request = get_request()
return request.PARENTS[-1]
def afterSetUp(self): def afterSetUp(self):
'''Called after setUp() has completed. This is '''Called after setUp() has completed. This is
far and away the most useful hook. far and away the most useful hook.
...@@ -158,6 +168,13 @@ class ERP5TypeLiveTestCase(ProcessingNodeTestCase, PortalTestCase): ...@@ -158,6 +168,13 @@ class ERP5TypeLiveTestCase(ProcessingNodeTestCase, PortalTestCase):
''' '''
pass pass
def beforeClear(self):
'''Called before _clear(). Subclasses should
use it to garbage collect objects which must not remain
in the system
'''
pass
def logMessage(self, message): def logMessage(self, message):
""" """
Shortcut function to log a message Shortcut function to log a message
......
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