Commit f250fc3f authored by Julien Muchembled's avatar Julien Muchembled

Unit tests: recognize 'erp5_sql_deferred_connection_string' environment variable

If not specified, erp5_sql_deferred_connection is configured like
erp5_sql_connection.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36451 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a8172cde
...@@ -233,23 +233,19 @@ def _getConnectionStringDict(): ...@@ -233,23 +233,19 @@ def _getConnectionStringDict():
"""Returns the connection strings used for this test. """Returns the connection strings used for this test.
""" """
connection_string_dict = {} connection_string_dict = {}
erp5_sql_connection_string = os.environ.get( default = os.environ.get('erp5_sql_connection_string')
'erp5_sql_connection_string') for connection in ('erp5_sql_connection_string',
if erp5_sql_connection_string: 'erp5_sql_deferred_connection_string',
connection_string_dict['erp5_sql_connection_string'] = \ # default value for transactionless is derived from value
erp5_sql_connection_string # for cmf_activity, so process it last
cmf_activity_sql_connection_string = os.environ.get( 'cmf_activity_sql_connection_string'):
'cmf_activity_sql_connection_string', connection_string = os.environ.get(connection, default)
os.environ.get('erp5_sql_connection_string')) if connection_string:
if cmf_activity_sql_connection_string: connection_string_dict[connection] = connection_string
connection_string_dict['cmf_activity_sql_connection_string'] = \ connection = 'erp5_sql_transactionless_connection_string'
cmf_activity_sql_connection_string if os.environ.get(connection, connection_string):
erp5_sql_transactionless_connection_string = os.environ.get( connection_string_dict[connection] = \
'erp5_sql_transactionless_connection_string', os.environ.get(connection, '-' + connection_string)
'-%s' % cmf_activity_sql_connection_string)
if erp5_sql_transactionless_connection_string:
connection_string_dict['erp5_sql_transactionless_connection_string'] = \
erp5_sql_transactionless_connection_string
return connection_string_dict return connection_string_dict
def _getConversionServerDict(): def _getConversionServerDict():
...@@ -898,10 +894,10 @@ class ERP5TypeTestCase(ProcessingNodeTestCase, PortalTestCase): ...@@ -898,10 +894,10 @@ class ERP5TypeTestCase(ProcessingNodeTestCase, PortalTestCase):
ZopeTestCase._print('Adding %s ERP5 Site ... ' % portal_name) ZopeTestCase._print('Adding %s ERP5 Site ... ' % portal_name)
extra_constructor_kw = _getConnectionStringDict() extra_constructor_kw = _getConnectionStringDict()
# manage_addERP5Site does not accept # manage_addERP5Site does not accept the following 2 arguments
# erp5_sql_transactionless_connection_string argument for k in ('erp5_sql_deferred_connection_string',
extra_constructor_kw.pop( 'erp5_sql_transactionless_connection_string'):
'erp5_sql_transactionless_connection_string', None) extra_constructor_kw.pop(k, None)
email_from_address = os.environ.get('email_from_address') email_from_address = os.environ.get('email_from_address')
if email_from_address is not None: if email_from_address is not None:
extra_constructor_kw['email_from_address'] = email_from_address extra_constructor_kw['email_from_address'] = email_from_address
......
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