commit/galaxy-central: greg: Exclude repositories that require excluded repositories from the tool shed's install and test runs.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/235cd1515a88/ Changeset: 235cd1515a88 User: greg Date: 2013-12-19 20:36:23 Summary: Exclude repositories that require excluded repositories from the tool shed's install and test runs. Affected #: 3 files diff -r 4b62b64265487834429b5337b6d3c3c9c38b072a -r 235cd1515a88fc394328a636ca4f08eb5608f3bd lib/galaxy/webapps/tool_shed/api/repository_revisions.py --- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py +++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py @@ -87,10 +87,10 @@ rd_tups = metadata[ 'repository_dependencies' ][ 'repository_dependencies' ] for rd_tup in rd_tups: tool_shed, name, owner, changeset_revision = rd_tup[ 0:4 ] - repository_dependencies_dict = dict( tool_shed=tool_shed, - name=name, - owner=owner, - changeset_revision=changeset_revision ) + repository_dependencies_dict = dict( tool_shed=str( tool_shed ), + name=str( name ), + owner=str( owner ), + changeset_revision=str( changeset_revision ) ) rd = suc.get_repository_by_name_and_owner( trans.app, name, owner ) encoded_rd_id = trans.security.encode_id( rd.id ) rd_repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans, diff -r 4b62b64265487834429b5337b6d3c3c9c38b072a -r 235cd1515a88fc394328a636ca4f08eb5608f3bd 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 @@ -375,6 +375,19 @@ hg_id = '%d:%s' % ( ctx_rev, str( changectx ) ) return hg_id +def get_repository_dependencies_for_changeset_revision( tool_shed_url, encoded_repository_metadata_id ): + """ + Return the list of dictionaries that define all repository dependencies of the repository_metadata + record associated with the received encoded_repository_metadata_id via the Tool Shed API. + """ + error_message = '' + parts = [ 'api', 'repository_revisions', encoded_repository_metadata_id, 'repository_dependencies' ] + api_url = get_api_url( base=tool_shed_url, parts=parts ) + repository_dependency_dicts, error_message = json_from_url( api_url ) + if error_message: + return None, error_message + return repository_dependency_dicts, error_message + def get_repository_dict( url, repository_dict ): error_message = '' parts = [ 'api', 'repositories', repository_dict[ 'repository_id' ] ] @@ -613,8 +626,8 @@ # </blacklist> # A list is returned with the following structure: # [{ '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 )]}] + # 'repositories': [( name, owner, changeset_revision if changeset_revision else None ), + # ( name, owner, changeset_revision if changeset_revision else None )]}] exclude_list = [] exclude_verbose = [] xml_tree, error_message = parse_xml( xml_filename ) diff -r 4b62b64265487834429b5337b6d3c3c9c38b072a -r 235cd1515a88fc394328a636ca4f08eb5608f3bd 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 @@ -100,9 +100,13 @@ # here because our call to the Tool Shed API filters by downloadable='true', in which case deleted will always be False. log.debug( 'Loading the list of repositories excluded from testing from the file %s...' % \ str( exclude_list_file ) ) - exclude_list = install_and_test_base_util.parse_exclude_list( exclude_list_file ) + # The following exclude_list will look something like this: + # [{ '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_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. @@ -146,15 +150,40 @@ 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: + 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 this_repository_is_in_the_exclude_list: + 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 + # Register the reason this repository is being skipped if, in fact, it is. + if this_repository_is_in_the_exclude_list or requires_excluded: tool_test_results_dict[ 'not_tested' ] = dict( reason=skip_reason ) params = dict( do_not_test=False ) # TODO: do something useful with response_dict 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