diff --git a/scripts/functional_tests.py b/scripts/functional_tests.py index d172c0c883e..2bb934fc2a8 100644 --- a/scripts/functional_tests.py +++ b/scripts/functional_tests.py @@ -170,8 +170,8 @@ def main(): template_cache_path = os.path.join( galaxy_db_path, 'compiled_templates' ) new_file_path = tempfile.mkdtemp( prefix='new_files_path_', dir=tempdir ) job_working_directory = tempfile.mkdtemp( prefix='job_working_directory_', dir=tempdir ) - install_database_connection = os.environ.get( 'GALAXY_TEST_INSTALL_DBURI', None ) database_connection, database_auto_migrate = driver_util.galaxy_database_conf(galaxy_db_path) + install_database_conf = driver_util.install_database_conf(galaxy_db_path, default_merged=True) kwargs = {} for dir in file_path, new_file_path, template_cache_path: try: @@ -224,8 +224,7 @@ def main(): enable_beta_tool_formats=True, auto_configure_logging=logging_config_file is None, data_manager_config_file=data_manager_config_file ) - if install_database_connection is not None: - kwargs[ 'install_database_connection' ] = install_database_connection + kwargs.update(install_database_conf) if not database_connection.startswith( 'sqlite://' ): kwargs[ 'database_engine_option_max_overflow' ] = '20' kwargs[ 'database_engine_option_pool_size' ] = '10' diff --git a/test/base/driver_util.py b/test/base/driver_util.py index b26f96cab42..7861305250a 100644 --- a/test/base/driver_util.py +++ b/test/base/driver_util.py @@ -23,6 +23,8 @@ from paste import httpserver from .nose_util import run from .instrument import StructuredTestDataPlugin +from galaxy.util import asbool + galaxy_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)) GALAXY_TEST_DIRECTORY = os.path.join(galaxy_root, "test") TOOL_SHED_TEST_DATA = os.path.join(GALAXY_TEST_DIRECTORY, "tool_shed", "test_data") @@ -127,6 +129,20 @@ def galaxy_database_conf(db_path): return database_connection, database_auto_migrate +def install_database_conf(db_path, default_merged=False): + if 'GALAXY_TEST_INSTALL_DBURI' in os.environ: + install_galaxy_database_connection = os.environ['GALAXY_TEST_INSTALL_DBURI'] + elif asbool(os.environ.get('GALAXY_TEST_INSTALL_DB_MERGED', default_merged)): + install_galaxy_database_connection = None + else: + install_galaxy_db_path = os.path.join(db_path, 'install.sqlite') + install_galaxy_database_connection = 'sqlite:///%s' % install_galaxy_db_path + conf = {} + if install_galaxy_database_connection is not None: + conf["install_database_connection"] = install_galaxy_database_connection + return conf + + def _get_static_settings(): """Configuration required for Galaxy static middleware. diff --git a/test/tool_shed/functional_tests.py b/test/tool_shed/functional_tests.py index 7eb95d487f9..0f9708a931a 100644 --- a/test/tool_shed/functional_tests.py +++ b/test/tool_shed/functional_tests.py @@ -20,7 +20,6 @@ from galaxy.webapps.tool_shed import buildapp as toolshedbuildapp from galaxy.webapps.tool_shed.app import UniverseApplication as ToolshedUniverseApplication # This is for the galaxy application. from galaxy.app import UniverseApplication as GalaxyUniverseApplication -from galaxy.util import asbool from galaxy.web import buildapp as galaxybuildapp from functional import database_contexts @@ -107,13 +106,7 @@ def main(): else: toolshed_database_connection = 'sqlite:///' + os.path.join( shed_db_path, 'community_test.sqlite' ) galaxy_database_connection, galaxy_database_auto_migrate = driver_util.galaxy_database_conf(galaxy_db_path) - if 'GALAXY_TEST_INSTALL_DBURI' in os.environ: - install_galaxy_database_connection = os.environ[ 'GALAXY_TEST_INSTALL_DBURI' ] - elif asbool( os.environ.get( 'GALAXY_TEST_INSTALL_DB_MERGED', default_install_db_merged ) ): - install_galaxy_database_connection = galaxy_database_connection - else: - install_galaxy_db_path = os.path.join( galaxy_db_path, 'install.sqlite' ) - install_galaxy_database_connection = 'sqlite:///%s' % install_galaxy_db_path + install_database_conf = driver_util.install_database_conf(galaxy_db_path, default_merged=False) tool_shed_global_conf = driver_util.get_webapp_global_conf() tool_shed_global_conf[ '__file__' ] = 'tool_shed_wsgi.ini.sample' kwargs = dict( admin_users='test@bx.psu.edu', @@ -205,7 +198,6 @@ def main(): allow_user_deletion=True, admin_users='test@bx.psu.edu', allow_library_path_paste=True, - install_database_connection=install_galaxy_database_connection, database_connection=galaxy_database_connection, database_auto_migrate=galaxy_database_auto_migrate, datatype_converters_config_file="datatype_converters_conf.xml.sample", @@ -234,8 +226,9 @@ def main(): update_integrated_tool_panel=False, use_heartbeat=False ) + kwargs.update(install_database_conf) # ---- Build Galaxy Application -------------------------------------------------- - if not galaxy_database_connection.startswith( 'sqlite://' ) and not install_galaxy_database_connection.startswith( 'sqlite://' ): + if not galaxy_database_connection.startswith( 'sqlite://' ): kwargs[ 'database_engine_option_pool_size' ] = '10' kwargs[ 'database_engine_option_max_overflow' ] = '20' galaxyapp = GalaxyUniverseApplication( **kwargs )