1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/427b0b131c3c/ Changeset: 427b0b131c3c User: greg Date: 2013-12-22 00:54:51 Summary: Don't attempt to install a repository if it was installed in a previous test within the tool shed's install and test framework. Affected #: 3 files diff -r 024ff5391a92b637cb71345ec078c0baf7f8b0a9 -r 427b0b131c3c74c12b115d36406b19d7fab1874a test/install_and_test_tool_shed_repositories/base/util.py --- a/test/install_and_test_tool_shed_repositories/base/util.py +++ b/test/install_and_test_tool_shed_repositories/base/util.py @@ -24,8 +24,6 @@ import tool_shed.util.shed_util_common as suc import urllib -from base.tool_shed_util import log_reason_repository_cannot_be_uninstalled - from common import update from galaxy.util import asbool @@ -387,6 +385,16 @@ log.debug( "Revision %s of repository %s owned by %s" % ( changeset_revision, name, owner ) ) return repository_dicts, error_message +def get_repository( name, owner, changeset_revision ): + """Return a repository record associated with the received name, owner, changeset_revision if one exists.""" + repository = None + try: + repository = test_db_util.get_installed_repository_by_name_owner_changeset_revision( name, owner, changeset_revision ) + except: + # The repository may not have been installed in a previous test. + pass + return repository + def get_repository_current_revision( repo_path ): """This method uses the python mercurial API to get the current working directory's mercurial changeset hash.""" # Initialize a mercurial repo object from the provided path. @@ -608,9 +616,9 @@ # Run the configured install method as a test. This method uses the embedded Galaxy application's web interface to # install the specified repository with tool and repository dependencies also selected for installation. result, _ = run_tests( test_config ) - try: - repository = test_db_util.get_installed_repository_by_name_owner_changeset_revision( name, owner, changeset_revision ) - except Exception, e: + # Get the repository record now that the tests that install it have completed. + repository = get_repository( name, owner, changeset_revision ) + if repository is None: error_message = 'Error getting revision %s of repository %s owned by %s: %s' % ( changeset_revision, name, owner, str( e ) ) log.exception( error_message ) return repository, error_message diff -r 024ff5391a92b637cb71345ec078c0baf7f8b0a9 -r 427b0b131c3c74c12b115d36406b19d7fab1874a test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py --- a/test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py +++ b/test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py @@ -196,85 +196,93 @@ log.debug( "Not testing revision %s of repository %s owned by %s because it is in the exclude list for this test run." % \ ( changeset_revision, name, owner ) ) else: - tool_test_results_dict = install_and_test_base_util.initialize_tool_tests_results_dict( app, tool_test_results_dict ) - repository, error_message = install_and_test_base_util.install_repository( app, repository_dict ) - install_and_test_statistics_dict[ 'total_repositories_processed' ] += 1 - if error_message: - # The repository installation failed. - log.debug( 'Installation failed for revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner ) ) - install_and_test_statistics_dict[ 'repositories_with_installation_error' ].append( repository_identifier_dict ) - tool_test_results_dict[ 'installation_errors' ][ 'current_repository' ] = error_message - params = dict( test_install_error=True ) - # TODO: do something useful with response_dict - response_dict = install_and_test_base_util.register_test_result( install_and_test_base_util.galaxy_tool_shed_url, + # See if the repository was installed in a previous test. + repository = get_repository( name, owner, changeset_revision ) + if repository is None: + # The repository was not previously installed, so install it now. + tool_test_results_dict = install_and_test_base_util.initialize_tool_tests_results_dict( app, tool_test_results_dict ) + repository, error_message = install_and_test_base_util.install_repository( app, repository_dict ) + install_and_test_statistics_dict[ 'total_repositories_processed' ] += 1 + if error_message: + # The repository installation failed. + log.debug( 'Installation failed for revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner ) ) + install_and_test_statistics_dict[ 'repositories_with_installation_error' ].append( repository_identifier_dict ) + tool_test_results_dict[ 'installation_errors' ][ 'current_repository' ] = error_message + params = dict( test_install_error=True ) + # TODO: do something useful with response_dict + response_dict = install_and_test_base_util.register_test_result( install_and_test_base_util.galaxy_tool_shed_url, + tool_test_results_dicts, + tool_test_results_dict, + repository_dict, + params, + can_update_tool_shed ) + else: + # The repository was successfully installed. + log.debug( 'Installation succeeded for revision %s of repository %s owned by %s.' % \ + ( changeset_revision, name, owner ) ) + params, install_and_test_statistics_dict, tool_test_results_dict = \ + install_and_test_base_util.register_installed_and_missing_dependencies( app, + repository, + repository_identifier_dict, + install_and_test_statistics_dict, + tool_test_results_dict ) + # Add an empty 'missing_test_results' entry if it is missing from the tool_test_results_dict. The + # ~/tool_shed/scripts/check_repositories_for_functional_tests.py will have entered information in the + # 'missing_test_components' entry of the tool_test_results_dict dictionary for repositories that are + # missing test components. + if 'missing_test_components' not in tool_test_results_dict: + tool_test_results_dict[ 'missing_test_components' ] = [] + missing_tool_dependencies = install_and_test_base_util.get_missing_tool_dependencies( repository ) + if missing_tool_dependencies or repository.missing_repository_dependencies: + install_and_test_base_util.handle_missing_dependencies( app=app, + repository=repository, + missing_tool_dependencies=missing_tool_dependencies, + repository_dict=repository_dict, + tool_test_results_dicts=tool_test_results_dicts, + tool_test_results_dict=tool_test_results_dict, + params=params, + can_update_tool_shed=can_update_tool_shed ) + else: + log.debug( 'Installation of %s succeeded, running all defined functional tests.' % str( repository.name ) ) + # Generate the shed_tools_dict that specifies the location of test data contained within this repository. + # and configure and run functional tests for this repository. This is equivalent to + # sh run_functional_tests.sh -installed + file( galaxy_shed_tools_dict, 'w' ).write( to_json_string( {} ) ) + # Find the path to the test-data directory within the installed repository. + has_test_data, shed_tools_dict = \ + parse_tool_panel_config( galaxy_shed_tool_conf_file, + from_json_string( file( galaxy_shed_tools_dict, 'r' ).read() ) ) + # If the repository has a test-data directory we write the generated shed_tools_dict to a temporary + # file so the functional test framework can find it. + file( galaxy_shed_tools_dict, 'w' ).write( to_json_string( shed_tools_dict ) ) + log.debug( 'Saved generated shed_tools_dict to %s\nContents: %s' % ( str( galaxy_shed_tools_dict ), + str( shed_tools_dict ) ) ) + try: + install_and_test_statistics_dict = test_repository_tools( app, + repository, + repository_dict, + tool_test_results_dicts, + tool_test_results_dict, + install_and_test_statistics_dict ) + except Exception, e: + exception_message = 'Error executing tests for repository %s: %s' % ( name, str( e ) ) + log.exception( exception_message ) + tool_test_results_dict[ 'failed_tests' ].append( exception_message ) + install_and_test_statistics_dict[ 'at_least_one_test_failed' ].append( repository_identifier_dict ) + # Record the status of this repository in the tool shed. + params[ 'tools_functionally_correct' ] = False + # TODO: do something useful with response_dict + response_dict = \ + install_and_test_base_util.register_test_result( install_and_test_base_util.galaxy_tool_shed_url, tool_test_results_dicts, tool_test_results_dict, repository_dict, params, can_update_tool_shed ) else: - # The repository was successfully installed. - log.debug( 'Installation succeeded for revision %s of repository %s owned by %s.' % \ + log.debug( 'Skipped attempt to install revision %s of repository %s owned by %s because ' % \ ( changeset_revision, name, owner ) ) - params, install_and_test_statistics_dict, tool_test_results_dict = \ - install_and_test_base_util.register_installed_and_missing_dependencies( app, - repository, - repository_identifier_dict, - install_and_test_statistics_dict, - tool_test_results_dict ) - # Add an empty 'missing_test_results' entry if it is missing from the tool_test_results_dict. The - # ~/tool_shed/scripts/check_repositories_for_functional_tests.py will have entered information in the - # 'missing_test_components' entry of the tool_test_results_dict dictionary for repositories that are - # missing test components. - if 'missing_test_components' not in tool_test_results_dict: - tool_test_results_dict[ 'missing_test_components' ] = [] - missing_tool_dependencies = install_and_test_base_util.get_missing_tool_dependencies( repository ) - if missing_tool_dependencies or repository.missing_repository_dependencies: - install_and_test_base_util.handle_missing_dependencies( app=app, - repository=repository, - missing_tool_dependencies=missing_tool_dependencies, - repository_dict=repository_dict, - tool_test_results_dicts=tool_test_results_dicts, - tool_test_results_dict=tool_test_results_dict, - params=params, - can_update_tool_shed=can_update_tool_shed ) - else: - log.debug( 'Installation of %s succeeded, running all defined functional tests.' % str( repository.name ) ) - # Generate the shed_tools_dict that specifies the location of test data contained within this repository. - # and configure and run functional tests for this repository. This is equivalent to - # sh run_functional_tests.sh -installed - file( galaxy_shed_tools_dict, 'w' ).write( to_json_string( {} ) ) - # Find the path to the test-data directory within the installed repository. - has_test_data, shed_tools_dict = \ - parse_tool_panel_config( galaxy_shed_tool_conf_file, - from_json_string( file( galaxy_shed_tools_dict, 'r' ).read() ) ) - # If the repository has a test-data directory we write the generated shed_tools_dict to a temporary - # file so the functional test framework can find it. - file( galaxy_shed_tools_dict, 'w' ).write( to_json_string( shed_tools_dict ) ) - log.debug( 'Saved generated shed_tools_dict to %s\nContents: %s' % ( str( galaxy_shed_tools_dict ), - str( shed_tools_dict ) ) ) - try: - install_and_test_statistics_dict = test_repository_tools( app, - repository, - repository_dict, - tool_test_results_dicts, - tool_test_results_dict, - install_and_test_statistics_dict ) - except Exception, e: - exception_message = 'Error executing tests for repository %s: %s' % ( name, str( e ) ) - log.exception( exception_message ) - tool_test_results_dict[ 'failed_tests' ].append( exception_message ) - install_and_test_statistics_dict[ 'at_least_one_test_failed' ].append( repository_identifier_dict ) - # Record the status of this repository in the tool shed. - params[ 'tools_functionally_correct' ] = False - # TODO: do something useful with response_dict - response_dict = \ - install_and_test_base_util.register_test_result( install_and_test_base_util.galaxy_tool_shed_url, - tool_test_results_dicts, - tool_test_results_dict, - repository_dict, - params, - can_update_tool_shed ) + log.debug( 'it was previously installed and currently has status %s' % str( repository.status ) ) return install_and_test_statistics_dict, error_message def main(): diff -r 024ff5391a92b637cb71345ec078c0baf7f8b0a9 -r 427b0b131c3c74c12b115d36406b19d7fab1874a test/install_and_test_tool_shed_repositories/tool_dependency_definitions/functional_tests.py --- a/test/install_and_test_tool_shed_repositories/tool_dependency_definitions/functional_tests.py +++ b/test/install_and_test_tool_shed_repositories/tool_dependency_definitions/functional_tests.py @@ -134,39 +134,47 @@ log.debug( "Not testing revision %s of repository %s owned by %s because it is in the exclude list for this test run." % \ ( changeset_revision, name, owner ) ) else: - tool_test_results_dict = install_and_test_base_util.initialize_tool_tests_results_dict( app, tool_test_results_dict ) - repository, error_message = install_and_test_base_util.install_repository( app, repository_dict ) - install_and_test_statistics_dict[ 'total_repositories_processed' ] += 1 - if error_message: - # The repository installation failed. - log.debug( 'Installation failed for revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner ) ) - install_and_test_statistics_dict[ 'repositories_with_installation_error' ].append( repository_identifier_dict ) - tool_test_results_dict[ 'installation_errors' ][ 'current_repository' ] = error_message - params = dict( test_install_error=True ) - # TODO: do something useful with response_dict - response_dict = install_and_test_base_util.register_test_result( install_and_test_base_util.galaxy_tool_shed_url, - tool_test_results_dicts, - tool_test_results_dict, - repository_dict, - params, - can_update_tool_shed ) + # See if the repository was installed in a previous test. + repository = get_repository( name, owner, changeset_revision ) + if repository is None: + # The repository was not previously installed, so install it now. + tool_test_results_dict = install_and_test_base_util.initialize_tool_tests_results_dict( app, tool_test_results_dict ) + repository, error_message = install_and_test_base_util.install_repository( app, repository_dict ) + install_and_test_statistics_dict[ 'total_repositories_processed' ] += 1 + if error_message: + # The repository installation failed. + log.debug( 'Installation failed for revision %s of repository %s owned by %s.' % ( changeset_revision, name, owner ) ) + install_and_test_statistics_dict[ 'repositories_with_installation_error' ].append( repository_identifier_dict ) + tool_test_results_dict[ 'installation_errors' ][ 'current_repository' ] = error_message + params = dict( test_install_error=True ) + # TODO: do something useful with response_dict + response_dict = install_and_test_base_util.register_test_result( install_and_test_base_util.galaxy_tool_shed_url, + tool_test_results_dicts, + tool_test_results_dict, + repository_dict, + params, + can_update_tool_shed ) + else: + # The repository was successfully installed. + log.debug( 'Installation succeeded for revision %s of repository %s owned by %s.' % \ + ( changeset_revision, name, owner ) ) + params, install_and_test_statistics_dict, tool_test_results_dict = \ + install_and_test_base_util.register_installed_and_missing_dependencies( app, + repository, + repository_identifier_dict, + install_and_test_statistics_dict, + tool_test_results_dict ) + # TODO: do something useful with response_dict + response_dict = install_and_test_base_util.register_test_result( install_and_test_base_util.galaxy_tool_shed_url, + tool_test_results_dicts, + tool_test_results_dict, + repository_dict, + params, + can_update_tool_shed ) else: - # The repository was successfully installed. - log.debug( 'Installation succeeded for revision %s of repository %s owned by %s.' % \ + log.debug( 'Skipped attempt to install revision %s of repository %s owned by %s because ' % \ ( changeset_revision, name, owner ) ) - params, install_and_test_statistics_dict, tool_test_results_dict = \ - install_and_test_base_util.register_installed_and_missing_dependencies( app, - repository, - repository_identifier_dict, - install_and_test_statistics_dict, - tool_test_results_dict ) - # TODO: do something useful with response_dict - response_dict = install_and_test_base_util.register_test_result( install_and_test_base_util.galaxy_tool_shed_url, - tool_test_results_dicts, - tool_test_results_dict, - repository_dict, - params, - can_update_tool_shed ) + log.debug( 'it was previously installed and currently has status %s' % str( repository.status ) ) return install_and_test_statistics_dict, error_message def 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.