commit/galaxy-central: greg: Refactor method to determine excluded repositories in the tool shed's install and test framework.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/2fcb2c12183d/ Changeset: 2fcb2c12183d User: greg Date: 2013-12-20 16:05:57 Summary: Refactor method to determine excluded repositories in the tool shed's install and test framework. Affected #: 3 files diff -r bedb1e48e5c724d817f1a695ed068e0745f066cd -r 2fcb2c12183df5ee7ec96d0f1a253c23448e4410 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 @@ -591,6 +591,41 @@ log.exception( error_message ) return repository, error_message +def is_excluded( exclude_list_dicts, name, owner, changeset_revision ): + """ + Return True if the repository defined by the received name, owner, changeset_revision should + be excluded from testing for any reason. + """ + for exclude_dict in exclude_list_dicts: + reason = exclude_dict[ 'reason' ] + exclude_repositories = exclude_dict[ 'repositories' ] + # 'repositories': + # [( name, owner, changeset_revision if changeset_revision else None ), + # ( name, owner, changeset_revision if changeset_revision else None )] + if ( name, owner, changeset_revision ) in exclude_repositories or ( name, owner, None ) in exclude_repositories: + return True, reason + # Skip this repository if it has a repository dependency that is in the exclude list. + repository_dependency_dicts, error_message = \ + get_repository_dependencies_for_changeset_revision( install_and_test_base_util.galaxy_tool_shed_url, + encoded_repository_metadata_id ) + if error_message: + log.debug( 'Error getting repository dependencies for revision %s of repository %s owned by %s:' % \ + ( changeset_revision, name, owner ) ) + log.debug( error_message ) + else: + for repository_dependency_dict in repository_dependency_dicts: + rd_name = repository_dependency_dict[ 'name' ] + rd_owner = repository_dependency_dict[ 'owner' ] + rd_changeset_revision = repository_dependency_dict[ 'changeset_revision' ] + if ( rd_name, rd_owner, rd_changeset_revision ) in exclude_repositories or \ + ( rd_name, rd_owner, None ) in exclude_repositories: + reason = 'This repository requires revision %s of repository %s owned by %s which is excluded from testing.' % \ + ( rd_changeset_revision, rd_name, rd_owner ) + return True, reason + break + return False, None + + def is_latest_downloadable_revision( url, repository_dict ): name = str( repository_dict[ 'name' ] ) owner = str( repository_dict[ 'owner' ] ) diff -r bedb1e48e5c724d817f1a695ed068e0745f066cd -r 2fcb2c12183df5ee7ec96d0f1a253c23448e4410 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 @@ -151,33 +151,15 @@ # [{ 'reason': The default reason or the reason specified in this section, # 'repositories': [( name, owner, changeset_revision if changeset_revision else None ), # ( name, owner, changeset_revision if changeset_revision else None )]}] - exclude_list = install_and_test_base_util.parse_exclude_list( exclude_list_file ) + exclude_list_dicts = install_and_test_base_util.parse_exclude_list( exclude_list_file ) else: - exclude_list = [] + exclude_list_dicts = [] # Generate a test method that will use Twill to install each repository into the embedded Galaxy application that was # started up, installing repository and tool dependencies. Upon successful installation, generate a test case for each # functional test defined for each tool in the repository and execute the test cases. Record the result of the tests. # The traceback and captured output of the tool that was run will be recored for test failures. After all tests have # completed, the repository is uninstalled, so test cases don't interfere with the next repository's functional tests. for repository_dict in repositories_to_install: - # Each repository_dict looks something like: - # { "changeset_revision": "13fa22a258b5", - # "contents_url": "/api/repositories/529fd61ab1c6cc36/contents", - # "deleted": false, - # "deprecated": false, - # "description": "Convert column case.", - # "downloadable": true, - # "id": "529fd61ab1c6cc36", - # "long_description": "This tool takes the specified columns and converts them to uppercase or lowercase.", - # "malicious": false, - # "name": "change_case", - # "owner": "test", - # "private": false, - # "repository_id": "529fd61ab1c6cc36", - # "times_downloaded": 0, - # "tool_shed_url": "http://toolshed.local:10001", - # "url": "/api/repository_revisions/529fd61ab1c6cc36", - # "user_id": "529fd61ab1c6cc36" } encoded_repository_metadata_id = repository_dict.get( 'id', None ) # Add the URL for the tool shed we're installing from, so the automated installation methods go to the right place. repository_dict[ 'tool_shed_url' ] = install_and_test_base_util.galaxy_tool_shed_url @@ -195,43 +177,10 @@ log.debug( error_message ) else: tool_test_results_dict = install_and_test_base_util.get_tool_test_results_dict( tool_test_results_dicts ) - # See if this repository should be skipped for any reason. - this_repository_is_in_the_exclude_list = False - requires_excluded = False - skip_reason = None - for exclude_dict in exclude_list: - reason = exclude_dict[ 'reason' ] - exclude_repositories = exclude_dict[ 'repositories' ] - # 'repositories': - # [( name, owner, changeset_revision if changeset_revision else None ), - # ( name, owner, changeset_revision if changeset_revision else None )] - if ( name, owner, changeset_revision ) in exclude_repositories or ( name, owner, None ) in exclude_repositories: - this_repository_is_in_the_exclude_list = True - skip_reason = reason - break - if not this_repository_is_in_the_exclude_list: - # Skip this repository if it has a repository dependency that is in the exclude list. - repository_dependency_dicts, error_message = \ - install_and_test_base_util.get_repository_dependencies_for_changeset_revision( install_and_test_base_util.galaxy_tool_shed_url, - encoded_repository_metadata_id ) - if error_message: - log.debug( 'Error getting repository dependencies for revision %s of repository %s owned by %s:' % \ - ( changeset_revision, name, owner ) ) - log.debug( error_message ) - else: - for repository_dependency_dict in repository_dependency_dicts: - rd_name = repository_dependency_dict[ 'name' ] - rd_owner = repository_dependency_dict[ 'owner' ] - rd_changeset_revision = repository_dependency_dict[ 'changeset_revision' ] - if ( rd_name, rd_owner, rd_changeset_revision ) in exclude_repositories or \ - ( rd_name, rd_owner, None ) in exclude_repositories: - skip_reason = 'This repository requires revision %s of repository %s owned by %s which is excluded from testing.' % \ - ( rd_changeset_revision, rd_name, rd_owner ) - requires_excluded = True - break - if this_repository_is_in_the_exclude_list or requires_excluded: + is_excluded, reason = install_and_test_base_util.is_excluded( exclude_list_dicts, name, owner, changeset_revision ) + if is_excluded: # If this repository is being skipped, register the reason. - tool_test_results_dict[ 'not_tested' ] = dict( reason=skip_reason ) + tool_test_results_dict[ 'not_tested' ] = dict( reason=reason ) params = dict( do_not_test=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, diff -r bedb1e48e5c724d817f1a695ed068e0745f066cd -r 2fcb2c12183df5ee7ec96d0f1a253c23448e4410 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 @@ -98,24 +98,6 @@ # The traceback and captured output of the tool that was run will be recored for test failures. After all tests have # completed, the repository is uninstalled, so test cases don't interfere with the next repository's functional tests. for repository_dict in repositories_to_install: - # Each repository_dict looks something like: - # { "changeset_revision": "13fa22a258b5", - # "contents_url": "/api/repositories/529fd61ab1c6cc36/contents", - # "deleted": false, - # "deprecated": false, - # "description": "Convert column case.", - # "downloadable": true, - # "id": "529fd61ab1c6cc36", - # "long_description": "This tool takes the specified columns and converts them to uppercase or lowercase.", - # "malicious": false, - # "name": "change_case", - # "owner": "test", - # "private": false, - # "repository_id": "529fd61ab1c6cc36", - # "times_downloaded": 0, - # "tool_shed_url": "http://toolshed.local:10001", - # "url": "/api/repository_revisions/529fd61ab1c6cc36", - # "user_id": "529fd61ab1c6cc36" } encoded_repository_metadata_id = repository_dict.get( 'id', None ) # Add the URL for the tool shed we're installing from, so the automated installation methods go to the right place. repository_dict[ 'tool_shed_url' ] = install_and_test_base_util.galaxy_tool_shed_url @@ -133,43 +115,10 @@ log.debug( error_message ) else: tool_test_results_dict = install_and_test_base_util.get_tool_test_results_dict( tool_test_results_dicts ) - # See if this repository should be skipped for any reason. - this_repository_is_in_the_exclude_list = False - requires_excluded = False - skip_reason = None - for exclude_dict in exclude_list_dicts: - reason = exclude_dict[ 'reason' ] - exclude_repositories = exclude_dict[ 'repositories' ] - # 'repositories': - # [( name, owner, changeset_revision if changeset_revision else None ), - # ( name, owner, changeset_revision if changeset_revision else None )] - if ( name, owner, changeset_revision ) in exclude_repositories or ( name, owner, None ) in exclude_repositories: - this_repository_is_in_the_exclude_list = True - skip_reason = reason - break - if not this_repository_is_in_the_exclude_list: - # Skip this repository if it has a repository dependency that is in the exclude list. - repository_dependency_dicts, error_message = \ - install_and_test_base_util.get_repository_dependencies_for_changeset_revision( install_and_test_base_util.galaxy_tool_shed_url, - encoded_repository_metadata_id ) - if error_message: - log.debug( 'Error getting repository dependencies for revision %s of repository %s owned by %s:' % \ - ( changeset_revision, name, owner ) ) - log.debug( error_message ) - else: - for repository_dependency_dict in repository_dependency_dicts: - rd_name = repository_dependency_dict[ 'name' ] - rd_owner = repository_dependency_dict[ 'owner' ] - rd_changeset_revision = repository_dependency_dict[ 'changeset_revision' ] - if ( rd_name, rd_owner, rd_changeset_revision ) in exclude_repositories or \ - ( rd_name, rd_owner, None ) in exclude_repositories: - skip_reason = 'This repository requires revision %s of repository %s owned by %s which is excluded from testing.' % \ - ( rd_changeset_revision, rd_name, rd_owner ) - requires_excluded = True - break + is_excluded, reason = install_and_test_base_util.is_excluded( exclude_list_dicts, name, owner, changeset_revision ) if this_repository_is_in_the_exclude_list or requires_excluded: # If this repository is being skipped, register the reason. - tool_test_results_dict[ 'not_tested' ] = dict( reason=skip_reason ) + tool_test_results_dict[ 'not_tested' ] = dict( reason=reason ) params = dict( do_not_test=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, 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