commit/galaxy-central: jmchilton: Mimic Galaxy functional test handling of GALAXY_TEST_DB_TEMPLATE for tool shed functional tests.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/97940f59772d/ Changeset: 97940f59772d User: jmchilton Date: 2013-11-27 15:37:30 Summary: Mimic Galaxy functional test handling of GALAXY_TEST_DB_TEMPLATE for tool shed functional tests. See 83a95ea606d9fcd15f7554b71804625e203eb1ed for full details (essentially GALAXY_TEST_DB_TEMPLATE can be sqlite file path or URL - will be copied over so original left in pristine state and auto upgraded as needed. Affected #: 1 file diff -r 0712180dc77d6df0f19870046562cc34317eb3cc -r 97940f59772dd8567c68cb8f895d00d99487fdb9 test/tool_shed/functional_tests.py --- a/test/tool_shed/functional_tests.py +++ b/test/tool_shed/functional_tests.py @@ -32,6 +32,7 @@ import twill, unittest, time import sys, threading, random import httplib, socket +import urllib from paste import httpserver # This is for the tool shed application. import galaxy.webapps.tool_shed.app @@ -186,10 +187,20 @@ toolshed_database_connection = os.environ[ 'TOOL_SHED_TEST_DBURI' ] else: toolshed_database_connection = 'sqlite:///' + os.path.join( shed_db_path, 'community_test.sqlite' ) + galaxy_database_auto_migrate = False if 'GALAXY_TEST_DBURI' in os.environ: galaxy_database_connection = os.environ[ 'GALAXY_TEST_DBURI' ] else: - galaxy_database_connection = 'sqlite:///' + os.path.join( galaxy_db_path, 'universe_test.sqlite' ) + db_path = os.path.join( galaxy_db_path, 'universe.sqlite' ) + if 'GALAXY_TEST_DB_TEMPLATE' in os.environ: + # Middle ground between recreating a completely new + # database and pointing at existing database with + # GALAXY_TEST_DBURI. The former requires a lot of setup + # time, the latter results in test failures in certain + # cases (namely tool shed tests expecting clean database). + __copy_database_template(os.environ['GALAXY_TEST_DB_TEMPLATE'], db_path) + galaxy_database_auto_migrate = True + galaxy_database_connection = 'sqlite:///%s' % db_path tool_shed_global_conf = get_webapp_global_conf() tool_shed_global_conf[ '__file__' ] = 'tool_shed_wsgi.ini.sample' kwargs = dict( admin_users = 'test@bx.psu.edu', @@ -311,6 +322,7 @@ admin_users = 'test@bx.psu.edu', allow_library_path_paste = True, database_connection = galaxy_database_connection, + database_auto_migrate = galaxy_database_auto_migrate, datatype_converters_config_file = "datatype_converters_conf.xml.sample", enable_tool_shed_check = True, file_path = galaxy_file_path, @@ -449,6 +461,22 @@ else: return 1 + +def __copy_database_template( source, db_path ): + """ + Copy a 'clean' sqlite template database (from file or URL) to specified + database path. + """ + os.makedirs( os.path.dirname( db_path ) ) + if os.path.exists( source ): + shutil.copy( source, db_path ) + assert os.path.exists( db_path ) + elif source.startswith("http"): + urllib.urlretrieve( source, db_path ) + else: + raise Exception( "Failed to copy database template from source %s" % source ) + + if __name__ == "__main__": try: sys.exit( main() ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org