1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/b9c93f559efa/ changeset: b9c93f559efa user: inithello date: 2013-02-20 20:27:36 summary: Extension of framework to automate the installation of a list of tool shed repositories to also run any functional tests in the tools contained within each repository. affected #: 6 files diff -r efebd50fd708aa3af73f954e4da68e88f2bced9a -r b9c93f559efa7a50cfa445b5f79c579690155589 install_and_test_tool_shed_repositories.sh --- /dev/null +++ b/install_and_test_tool_shed_repositories.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# A good place to look for nose info: http://somethingaboutorange.com/mrl/projects/nose/ +#rm -f ./test/tool_shed/run_functional_tests.log + +python test/install_and_test_tool_shed_repositories/functional_tests.py -v --with-nosehtml --html-report-file ./test/install_and_test_tool_shed_repositories/run_functional_tests.html test/install_and_test_tool_shed_repositories/functional/test_install_repositories.py test/functional/test_toolbox.py + diff -r efebd50fd708aa3af73f954e4da68e88f2bced9a -r b9c93f559efa7a50cfa445b5f79c579690155589 scripts/functional_tests.py --- a/scripts/functional_tests.py +++ b/scripts/functional_tests.py @@ -4,10 +4,12 @@ # Assume we are run from the galaxy root directory, add lib to the python path cwd = os.getcwd() -new_path = [ os.path.join( cwd, "lib" ) ] +new_path = [ os.path.join( cwd, "lib" ), os.path.join( cwd, "test" ) ] new_path.extend( sys.path[1:] ) sys.path = new_path +from base.util import parse_tool_panel_config + from galaxy import eggs eggs.require( "nose" ) @@ -85,73 +87,6 @@ global_conf.update( get_static_settings() ) return global_conf -def parse_tool_panel_config( config, shed_tools_dict ): - """ - Parse a shed-related tool panel config to generate the shed_tools_dict. This only happens when testing tools installed from the tool shed. - """ - last_galaxy_test_file_dir = None - last_tested_repository_name = None - last_tested_changeset_revision = None - tool_path = None - tree = util.parse_xml( config ) - root = tree.getroot() - tool_path = root.get('tool_path') - for elem in root: - if elem.tag == 'tool': - galaxy_test_file_dir, \ - last_tested_repository_name, \ - last_tested_changeset_revision = get_installed_repository_info( elem, - last_galaxy_test_file_dir, - last_tested_repository_name, - last_tested_changeset_revision, - tool_path ) - if galaxy_test_file_dir: - if galaxy_test_file_dir != last_galaxy_test_file_dir: - if not os.path.isabs( galaxy_test_file_dir ): - galaxy_test_file_dir = os.path.join( os.getcwd(), galaxy_test_file_dir ) - guid = elem.get( 'guid' ) - shed_tools_dict[ guid ] = galaxy_test_file_dir - last_galaxy_test_file_dir = galaxy_test_file_dir - elif elem.tag == 'section': - for section_elem in elem: - if section_elem.tag == 'tool': - galaxy_test_file_dir, \ - last_tested_repository_name, \ - last_tested_changeset_revision = get_installed_repository_info( section_elem, - last_galaxy_test_file_dir, - last_tested_repository_name, - last_tested_changeset_revision, - tool_path ) - if galaxy_test_file_dir: - if galaxy_test_file_dir != last_galaxy_test_file_dir: - if not os.path.isabs( galaxy_test_file_dir ): - galaxy_test_file_dir = os.path.join( os.getcwd(), galaxy_test_file_dir ) - guid = section_elem.get( 'guid' ) - shed_tools_dict[ guid ] = galaxy_test_file_dir - last_galaxy_test_file_dir = galaxy_test_file_dir - return shed_tools_dict - -def get_installed_repository_info( elem, last_galaxy_test_file_dir, last_tested_repository_name, last_tested_changeset_revision, tool_path ): - """ - Return the GALAXY_TEST_FILE_DIR, the containing repository name and the change set revision for the tool elem. - This only happens when testing tools installed from the tool shed. - """ - tool_config_path = elem.get( 'file' ) - installed_tool_path_items = tool_config_path.split( '/repos/' ) - sans_shed = installed_tool_path_items[ 1 ] - path_items = sans_shed.split( '/' ) - repository_owner = path_items[ 0 ] - repository_name = path_items[ 1 ] - changeset_revision = path_items[ 2 ] - if repository_name != last_tested_repository_name or changeset_revision != last_tested_changeset_revision: - # Locate the test-data directory. - installed_tool_path = os.path.join( installed_tool_path_items[ 0 ], 'repos', repository_owner, repository_name, changeset_revision ) - for root, dirs, files in os.walk( os.path.join(tool_path, installed_tool_path )): - if 'test-data' in dirs: - return os.path.join( root, 'test-data' ), repository_name, changeset_revision - return None, repository_name, changeset_revision - return last_galaxy_test_file_dir, last_tested_repository_name, last_tested_changeset_revision - def run_tests( test_config ): loader = nose.loader.TestLoader( config=test_config ) plug_loader = test_config.plugins.prepareTestLoader( loader ) diff -r efebd50fd708aa3af73f954e4da68e88f2bced9a -r b9c93f559efa7a50cfa445b5f79c579690155589 test/base/util.py --- /dev/null +++ b/test/base/util.py @@ -0,0 +1,80 @@ +import os, sys + +cwd = os.getcwd() +if cwd not in sys.path: + sys.path.append( cwd ) + +new_path = [ os.path.join( cwd, "lib" ) ] +if new_path not in sys.path: + new_path.extend( sys.path ) + sys.path = new_path + +from galaxy.util import parse_xml + +def get_installed_repository_info( elem, last_galaxy_test_file_dir, last_tested_repository_name, last_tested_changeset_revision, tool_path ): + """ + Return the GALAXY_TEST_FILE_DIR, the containing repository name and the change set revision for the tool elem. + This only happens when testing tools installed from the tool shed. + """ + tool_config_path = elem.get( 'file' ) + installed_tool_path_items = tool_config_path.split( '/repos/' ) + sans_shed = installed_tool_path_items[ 1 ] + path_items = sans_shed.split( '/' ) + repository_owner = path_items[ 0 ] + repository_name = path_items[ 1 ] + changeset_revision = path_items[ 2 ] + if repository_name != last_tested_repository_name or changeset_revision != last_tested_changeset_revision: + # Locate the test-data directory. + installed_tool_path = os.path.join( installed_tool_path_items[ 0 ], 'repos', repository_owner, repository_name, changeset_revision ) + for root, dirs, files in os.walk( os.path.join(tool_path, installed_tool_path )): + if 'test-data' in dirs: + return os.path.join( root, 'test-data' ), repository_name, changeset_revision + return None, repository_name, changeset_revision + return last_galaxy_test_file_dir, last_tested_repository_name, last_tested_changeset_revision + +def parse_tool_panel_config( config, shed_tools_dict ): + """ + Parse a shed-related tool panel config to generate the shed_tools_dict. This only happens when testing tools installed from the tool shed. + """ + last_galaxy_test_file_dir = None + last_tested_repository_name = None + last_tested_changeset_revision = None + tool_path = None + tree = parse_xml( config ) + root = tree.getroot() + tool_path = root.get('tool_path') + for elem in root: + if elem.tag == 'tool': + galaxy_test_file_dir, \ + last_tested_repository_name, \ + last_tested_changeset_revision = get_installed_repository_info( elem, + last_galaxy_test_file_dir, + last_tested_repository_name, + last_tested_changeset_revision, + tool_path ) + if galaxy_test_file_dir: + if galaxy_test_file_dir != last_galaxy_test_file_dir: + if not os.path.isabs( galaxy_test_file_dir ): + galaxy_test_file_dir = os.path.join( os.getcwd(), galaxy_test_file_dir ) + guid = elem.get( 'guid' ) + shed_tools_dict[ guid ] = galaxy_test_file_dir + last_galaxy_test_file_dir = galaxy_test_file_dir + elif elem.tag == 'section': + for section_elem in elem: + if section_elem.tag == 'tool': + galaxy_test_file_dir, \ + last_tested_repository_name, \ + last_tested_changeset_revision = get_installed_repository_info( section_elem, + last_galaxy_test_file_dir, + last_tested_repository_name, + last_tested_changeset_revision, + tool_path ) + if galaxy_test_file_dir: + if galaxy_test_file_dir != last_galaxy_test_file_dir: + if not os.path.isabs( galaxy_test_file_dir ): + galaxy_test_file_dir = os.path.join( os.getcwd(), galaxy_test_file_dir ) + guid = section_elem.get( 'guid' ) + shed_tools_dict[ guid ] = galaxy_test_file_dir + last_galaxy_test_file_dir = galaxy_test_file_dir + return shed_tools_dict + diff -r efebd50fd708aa3af73f954e4da68e88f2bced9a -r b9c93f559efa7a50cfa445b5f79c579690155589 test/install_and_test_tool_shed_repositories/base/twilltestcase.py --- a/test/install_and_test_tool_shed_repositories/base/twilltestcase.py +++ b/test/install_and_test_tool_shed_repositories/base/twilltestcase.py @@ -121,4 +121,12 @@ ( timeout_counter, repository.status ) ) break time.sleep( 1 ) + def uninstall_repository( self, installed_repository ): + url = '/admin_toolshed/deactivate_or_uninstall_repository?id=%s' % self.security.encode_id( installed_repository.id ) + self.visit_url( url ) + tc.fv ( 1, "remove_from_disk", 'true' ) + tc.submit( 'deactivate_or_uninstall_repository_button' ) + strings_displayed = [ 'The repository named' ] + strings_displayed.append( 'has been uninstalled' ) + self.check_for_strings( strings_displayed, strings_not_displayed=[] ) diff -r efebd50fd708aa3af73f954e4da68e88f2bced9a -r b9c93f559efa7a50cfa445b5f79c579690155589 test/install_and_test_tool_shed_repositories/functional/test_install_repositories.py --- a/test/install_and_test_tool_shed_repositories/functional/test_install_repositories.py +++ b/test/install_and_test_tool_shed_repositories/functional/test_install_repositories.py @@ -1,18 +1,33 @@ -import new +import new, logging import install_and_test_tool_shed_repositories.base.test_db_util as test_db_util from install_and_test_tool_shed_repositories.base.twilltestcase import InstallTestRepository +log = logging.getLogger(__name__) class TestInstallRepositories( InstallTestRepository ): - """Abstract test case that installs a predefined list of repositories.""" + """Abstract test case that installs and uninstalls a predefined list of repositories.""" def do_installation( self, repository_info_dict ): self.logout() self.login( email='test@bx.psu.edu', username='test' ) admin_user = test_db_util.get_user( 'test@bx.psu.edu' ) assert admin_user is not None, 'Problem retrieving user with email %s from the database' % admin_email admin_user_private_role = test_db_util.get_private_role( admin_user ) + # Install the repository through the web interface using twill. self.install_repository( repository_info_dict ) -def build_tests( repository_dict=None ): + def do_uninstallation( self, repository_info_dict ): + self.logout() + self.login( email='test@bx.psu.edu', username='test' ) + admin_user = test_db_util.get_user( 'test@bx.psu.edu' ) + assert admin_user is not None, 'Problem retrieving user with email %s from the database' % admin_email + # Get the repository from the database. + repository = test_db_util.get_installed_repository_by_name_owner_changeset_revision( repository_info_dict[ 'name' ], + repository_info_dict[ 'owner' ], + repository_info_dict[ 'changeset_revision' ] ) + admin_user_private_role = test_db_util.get_private_role( admin_user ) + # Uninstall the repository through the web interface using twill. + self.uninstall_repository( repository ) + +def generate_install_method( repository_dict=None ): """Generate abstract test cases for the defined list of repositories.""" if repository_dict is None: return @@ -20,7 +35,7 @@ G = globals() # Eliminate all previous tests from G. for key, val in G.items(): - if key.startswith( 'TestInstallRepository_' ): + if key.startswith( 'TestInstallRepository_' ) or key.startswith( 'TestUninstallRepository_' ): del G[ key ] # Create a new subclass with a method named install_repository_XXX that installs the repository specified by the provided dict. name = "TestInstallRepository_" + repository_dict[ 'name' ] @@ -37,3 +52,29 @@ # from baseclasses (which should be a tuple of classes) and with namespace dict. new_class_obj = new.classobj( name, baseclasses, namespace ) G[ name ] = new_class_obj + +def generate_uninstall_method( repository_dict=None ): + """Generate abstract test cases for the defined list of repositories.""" + if repository_dict is None: + return + # Push all the toolbox tests to module level + G = globals() + # Eliminate all previous tests from G. + for key, val in G.items(): + if key.startswith( 'TestInstallRepository_' ) or key.startswith( 'TestUninstallRepository_' ): + del G[ key ] + # Create a new subclass with a method named install_repository_XXX that installs the repository specified by the provided dict. + name = "TestUninstallRepository_" + repository_dict[ 'name' ] + baseclasses = ( TestInstallRepositories, ) + namespace = dict() + def make_uninstall_method( repository_dict ): + def test_install_repository( self ): + self.do_uninstallation( repository_dict ) + return test_install_repository + test_method = make_uninstall_method( repository_dict ) + test_method.__doc__ = "Uninstall the repository %s." % repository_dict[ 'name' ] + namespace[ 'install_repository_%s' % repository_dict[ 'name' ] ] = test_method + # The new.classobj function returns a new class object, with name name, derived + # from baseclasses (which should be a tuple of classes) and with namespace dict. + new_class_obj = new.classobj( name, baseclasses, namespace ) + G[ name ] = new_class_obj diff -r efebd50fd708aa3af73f954e4da68e88f2bced9a -r b9c93f559efa7a50cfa445b5f79c579690155589 test/install_and_test_tool_shed_repositories/functional_tests.py --- a/test/install_and_test_tool_shed_repositories/functional_tests.py +++ b/test/install_and_test_tool_shed_repositories/functional_tests.py @@ -1,5 +1,9 @@ #!/usr/bin/env python +# NOTE: This script cannot be run directly, because it needs to have test/functional/test_toolbox.py in sys.argv in +# order to run functional tests on repository tools after installation. The install_and_test_tool_shed_repositories.sh +# will execute this script with the appropriate parameters. + import os, sys, shutil, tempfile, re, string # Assume we are run from the galaxy root directory, add lib to the python path @@ -8,9 +12,9 @@ test_home_directory = os.path.join( cwd, 'test', 'install_and_test_tool_shed_repositories' ) default_test_file_dir = os.path.join( test_home_directory, 'test_data' ) + # Here's the directory where everything happens. Temporary directories are created within this directory to contain -# the hgweb.config file, the database, new repositories, etc. Since the tool shed browses repository contents via HTTP, -# the full path to the temporary directroy wher eht repositories are located cannot contain invalid url characters. +# the database, new repositories, etc. galaxy_test_tmp_dir = os.path.join( test_home_directory, 'tmp' ) default_galaxy_locales = 'en' default_galaxy_test_file_dir = "test-data" @@ -43,12 +47,15 @@ import galaxy.app from galaxy.app import UniverseApplication from galaxy.web import buildapp +from galaxy.util import parse_xml import nose.core import nose.config import nose.loader import nose.plugins.manager +from base.util import parse_tool_panel_config + log = logging.getLogger( 'install_and_test_repositories' ) default_galaxy_test_port_min = 10000 @@ -66,11 +73,13 @@ </tool_sheds> ''' +# Create a blank shed_tool_conf.xml to hold the installed repositories. shed_tool_conf_xml_template = '''<?xml version="1.0"?><toolbox tool_path="${shed_tool_path}"></toolbox> ''' +# Since we will be running functional tests, we'll need the upload tool, but the rest can be omitted. tool_conf_xml = '''<?xml version="1.0"?><toolbox><section name="Get Data" id="getext"> @@ -79,11 +88,13 @@ </toolbox> ''' +# And set up a blank tool_data_table_conf.xml and shed_tool_data_table_conf.xml. tool_data_table_conf_xml_template = '''<?xml version="1.0"?><tables></tables> ''' +# Define a default location to find the list of repositories to check. galaxy_repository_list = os.environ.get( 'GALAXY_INSTALL_TEST_REPOSITORY_FILE', 'repository_list.json' ) if 'GALAXY_INSTALL_TEST_SECRET' not in os.environ: @@ -92,7 +103,7 @@ else: galaxy_encode_secret = os.environ[ 'GALAXY_INSTALL_TEST_SECRET' ] -def get_repositories_to_install(): +def get_repositories_to_install( format='json' ): ''' Get a list of repository info dicts to install. This method expects a json list of dicts with the following structure: [ @@ -107,7 +118,10 @@ ] NOTE: If the tool shed URL specified in any dict is not present in the tool_sheds_conf.xml, the installation will fail. ''' - return simplejson.loads( file( galaxy_repository_list, 'r' ).read() ) + if format == 'json': + return simplejson.loads( file( galaxy_repository_list, 'r' ).read() ) + else: + raise AssertonError( 'Unknown format %s.' % format ) def run_tests( test_config ): loader = nose.loader.TestLoader( config=test_config ) @@ -126,7 +140,7 @@ def main(): # ---- Configuration ------------------------------------------------------ galaxy_test_host = os.environ.get( 'GALAXY_INSTALL_TEST_HOST', default_galaxy_test_host ) - galaxy_test_port = os.environ.get( 'GALAXY_INSTALL_TEST_PORT', None ) + galaxy_test_port = os.environ.get( 'GALAXY_INSTALL_TEST_PORT', str( default_galaxy_test_port_max ) ) tool_path = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_PATH', 'tools' ) if 'HTTP_ACCEPT_LANGUAGE' not in os.environ: @@ -134,28 +148,32 @@ galaxy_test_file_dir = os.environ.get( 'GALAXY_INSTALL_TEST_FILE_DIR', default_galaxy_test_file_dir ) if not os.path.isabs( galaxy_test_file_dir ): galaxy_test_file_dir = os.path.abspath( galaxy_test_file_dir ) + # Set up the tool dependency path for the Galaxy instance. tool_dependency_dir = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DEPENDENCY_DIR', None ) use_distributed_object_store = os.environ.get( 'GALAXY_INSTALL_TEST_USE_DISTRIBUTED_OBJECT_STORE', False ) if not os.path.isdir( galaxy_test_tmp_dir ): os.mkdir( galaxy_test_tmp_dir ) galaxy_test_proxy_port = None + # Set up the configuration files for the Galaxy instance. shed_tool_data_table_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_DATA_TABLE_CONF', os.path.join( galaxy_test_tmp_dir, 'test_shed_tool_data_table_conf.xml' ) ) galaxy_tool_data_table_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DATA_TABLE_CONF', os.path.join( galaxy_test_tmp_dir, 'test_tool_data_table_conf.xml' ) ) galaxy_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_CONF', os.path.join( galaxy_test_tmp_dir, 'test_tool_conf.xml' ) ) galaxy_shed_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_CONF', os.path.join( galaxy_test_tmp_dir, 'test_shed_tool_conf.xml' ) ) galaxy_migrated_tool_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_MIGRATED_TOOL_CONF', os.path.join( galaxy_test_tmp_dir, 'test_migrated_tool_conf.xml' ) ) galaxy_tool_sheds_conf_file = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_SHEDS_CONF', os.path.join( galaxy_test_tmp_dir, 'test_tool_sheds_conf.xml' ) ) - shed_tool_dict = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_DICT_FILE', os.path.join( galaxy_test_tmp_dir, 'shed_tool_dict' ) ) + galaxy_shed_tools_dict = os.environ.get( 'GALAXY_INSTALL_TEST_SHED_TOOL_DICT_FILE', os.path.join( galaxy_test_tmp_dir, 'shed_tool_dict' ) ) if 'GALAXY_INSTALL_TEST_TOOL_DATA_PATH' in os.environ: tool_data_path = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DATA_PATH' ) else: tool_data_path = tempfile.mkdtemp( dir=galaxy_test_tmp_dir ) os.environ[ 'GALAXY_INSTALL_TEST_TOOL_DATA_PATH' ] = tool_data_path + # Configure the database connection and path. if 'GALAXY_INSTALL_TEST_DBPATH' in os.environ: galaxy_db_path = os.environ[ 'GALAXY_INSTALL_TEST_DBPATH' ] else: tempdir = tempfile.mkdtemp( dir=galaxy_test_tmp_dir ) galaxy_db_path = os.path.join( tempdir, 'database' ) + # Configure the paths Galaxy needs to install and test tools. galaxy_file_path = os.path.join( galaxy_db_path, 'files' ) new_repos_path = tempfile.mkdtemp( dir=galaxy_test_tmp_dir ) galaxy_tempfiles = tempfile.mkdtemp( dir=galaxy_test_tmp_dir ) @@ -239,6 +257,7 @@ static_enabled=False, app=app ) + # Serve the app on a specified or random port. if galaxy_test_port is not None: server = httpserver.serve( webapp, host=galaxy_test_host, port=galaxy_test_port, start_loop=False ) else: @@ -260,9 +279,10 @@ os.environ[ 'GALAXY_INSTALL_TEST_PORT' ] = galaxy_test_proxy_port else: os.environ[ 'GALAXY_INSTALL_TEST_PORT' ] = galaxy_test_port + # Start the server. t = threading.Thread( target=server.serve_forever ) t.start() - # Test if the server is up + # Test if the server is up. for i in range( 10 ): # Directly test the app, not the proxy. conn = httplib.HTTPConnection( galaxy_test_host, galaxy_test_port ) @@ -273,27 +293,71 @@ else: raise Exception( "Test HTTP server did not return '200 OK' after 10 tries" ) log.info( "Embedded galaxy web server started" ) - # ---- Load the module to generate installation methods ------------------- + # ---- Load the modules to generate installation, testing, and uninstallation methods ------------------- import install_and_test_tool_shed_repositories.functional.test_install_repositories as test_install_repositories + import functional.test_toolbox as test_toolbox if galaxy_test_proxy_port: log.info( "Tests will be run against %s:%s" % ( galaxy_test_host, galaxy_test_proxy_port ) ) else: log.info( "Tests will be run against %s:%s" % ( galaxy_test_host, galaxy_test_port ) ) success = False try: + # Iterate through a list of repository info dicts. for repository_dict in get_repositories_to_install(): - test_install_repositories.build_tests( repository_dict ) + # Generate the method that will install this repository into the running Galaxy instance. + test_install_repositories.generate_install_method( repository_dict ) os.environ[ 'GALAXY_INSTALL_TEST_HOST' ] = galaxy_test_host + # Configure nose to run the install method as a test. test_config = nose.config.Config( env=os.environ, plugins=nose.plugins.manager.DefaultPluginManager() ) test_config.configure( sys.argv ) - # Run the tests. + # Run the configured install method as a test. This method uses the Galaxy web interface to install the specified + # repository, with tool and repository dependencies also selected for installation. result = run_tests( test_config ) success = result.wasSuccessful() + # If the installation succeeds, set up and run functional tests for this repository. This is equivalent to + # sh run_functional_tests.sh -installed + if success: + log.debug( 'Installation of %s succeeded, running any defined functional tests.' % repository_dict[ 'name' ] ) + # Parse the tool panel config to get the test-data path for this repository. + shed_tools_dict = parse_tool_panel_config( galaxy_shed_tool_conf_file, {} ) + # Write this to a file, so the functional test framework can find it. + file( galaxy_shed_tools_dict, 'w' ).write( simplejson.dumps( shed_tools_dict ) ) + # Set up the environment so that test.functional.test_toolbox can find the Galaxy server we configured in this framework. + os.environ[ 'GALAXY_TOOL_SHED_TEST_FILE' ] = galaxy_shed_tools_dict + os.environ[ 'GALAXY_TEST_HOST' ] = galaxy_test_host + os.environ[ 'GALAXY_TEST_PORT' ] = galaxy_test_port + # Set the module-level variable 'toolbox', so that test.functional.test_toolbox will generate the appropriate test methods. + test_toolbox.toolbox = app.toolbox + # Generate the test methods for this installed repository. We need to pass in True here, or it will look + # in $GALAXY_HOME/test-data for test data, which may result in missing or invalid test files. + test_toolbox.build_tests( testing_shed_tools=True ) + # Set up nose to run the generated functional tests. + test_config = nose.config.Config( env=os.environ, plugins=nose.plugins.manager.DefaultPluginManager() ) + test_config.configure( sys.argv ) + # Run the configured tests. + result = run_tests( test_config ) + success = result.wasSuccessful() + if success: + log.debug( 'Repository %s installed and passed functional tests.' % repository_dict[ 'name' ] ) + else: + log.debug( 'Repository %s installed, but did not pass functional tests.' % repository_dict[ 'name' ] ) + # Generate an uninstall method for this repository, so that the next repository has a clean environment for testing. + test_install_repositories.generate_uninstall_method( repository_dict ) + # Set up nose to run the generated uninstall method as a functional test. + test_config = nose.config.Config( env=os.environ, plugins=nose.plugins.manager.DefaultPluginManager() ) + test_config.configure( sys.argv ) + # Run the uninstall method. This method uses the Galaxy web interface to uninstall the previously installed + # repository and delete it from disk. + result = run_tests( test_config ) + success = result.wasSuccessful() + else: + log.debug( 'Repository %s failed to install correctly.' % repository_dict[ 'name' ] ) except: log.exception( "Failure running tests" ) log.info( "Shutting down" ) # ---- Tear down ----------------------------------------------------------- + # Gracefully shut down the embedded web server and UniverseApplication. if server: log.info( "Shutting down embedded galaxy web server" ) server.server_close() @@ -304,6 +368,7 @@ app.shutdown() app = None log.info( "Embedded galaxy application stopped" ) + # Clean up test files unless otherwise specified. if 'GALAXY_INSTALL_TEST_NO_CLEANUP' not in os.environ: try: for dir in [ galaxy_test_tmp_dir ]: 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.