commit/galaxy-central: Dave Bouvier: When the install and test framework has finished testing a repository, use deactivate instead of uninstall, so that installed tool dependencies are retained.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/149dbd29acbc/ Changeset: 149dbd29acbc User: Dave Bouvier Date: 2013-09-09 19:44:03 Summary: When the install and test framework has finished testing a repository, use deactivate instead of uninstall, so that installed tool dependencies are retained. Affected #: 1 file diff -r 1a868f109ed985b738c709422dbd6cccbc5cdd32 -r 149dbd29acbce6396a969662a9b899cdbb7bdb46 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 @@ -6,7 +6,9 @@ log = logging.getLogger( __name__ ) + class InstallTestRepository( TwillTestCase ): + def setUp( self ): # Security helper id_secret = os.environ.get( 'GALAXY_INSTALL_TEST_SECRET', 'changethisinproductiontoo' ) @@ -24,21 +26,22 @@ self.galaxy_tool_dependency_dir = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DEPENDENCY_DIR' ) self.shed_tools_dict = {} self.home() - def initiate_installation_process( self, - install_tool_dependencies=False, - install_repository_dependencies=True, - no_changes=True, + + def initiate_installation_process( self, + install_tool_dependencies=False, + install_repository_dependencies=True, + no_changes=True, new_tool_panel_section=None ): html = self.last_page() - # Since the installation process is by necessity asynchronous, we have to get the parameters to 'manually' initiate the - # installation process. This regex will return the tool shed repository IDs in group(1), the encoded_kwd parameter in - # group(2), and the reinstalling flag in group(3) and pass them to the manage_repositories method in the Galaxy + # Since the installation process is by necessity asynchronous, we have to get the parameters to 'manually' initiate the + # installation process. This regex will return the tool shed repository IDs in group(1), the encoded_kwd parameter in + # group(2), and the reinstalling flag in group(3) and pass them to the manage_repositories method in the Galaxy # admin_toolshed controller. install_parameters = re.search( 'initiate_repository_installation\( "([^"]+)", "([^"]+)", "([^"]+)" \);', html ) if install_parameters: iri_ids = install_parameters.group(1) # In some cases, the returned iri_ids are of the form: "[u'<encoded id>', u'<encoded id>']" - # This regex ensures that non-hex characters are stripped out of the list, so that util.listify/decode_id + # This regex ensures that non-hex characters are stripped out of the list, so that util.listify/decode_id # will handle them correctly. It's safe to pass the cleaned list to manage_repositories, because it can parse # comma-separated values. repository_ids = str( iri_ids ) @@ -49,8 +52,9 @@ ( ','.join( util.listify( repository_ids ) ), encoded_kwd, reinstalling ) self.visit_url( url ) return util.listify( repository_ids ) - def install_repository( self, repository_info_dict, install_tool_dependencies=True, install_repository_dependencies=True, - strings_displayed=[], strings_not_displayed=[], preview_strings_displayed=[], + + def install_repository( self, repository_info_dict, install_tool_dependencies=True, install_repository_dependencies=True, + strings_displayed=[], strings_not_displayed=[], preview_strings_displayed=[], post_submit_strings_displayed=[], new_tool_panel_section=None, **kwd ): name = repository_info_dict[ 'name' ] owner = repository_info_dict[ 'owner' ] @@ -59,23 +63,23 @@ tool_shed_url = repository_info_dict[ 'tool_shed_url' ] preview_params = urllib.urlencode( dict( repository_id=encoded_repository_id, changeset_revision=changeset_revision ) ) self.visit_url( '%s/repository/preview_tools_in_changeset?%s' % ( tool_shed_url, preview_params ) ) - install_params = urllib.urlencode( dict( repository_ids=encoded_repository_id, + install_params = urllib.urlencode( dict( repository_ids=encoded_repository_id, changeset_revisions=changeset_revision, galaxy_url=self.url ) ) - # If the tool shed does not have the same hostname as the Galaxy server being used for these tests, - # twill will not carry over previously set cookies for the Galaxy server when following the - # install_repositories_by_revision redirect, so we have to include 403 in the allowed HTTP + # If the tool shed does not have the same hostname as the Galaxy server being used for these tests, + # twill will not carry over previously set cookies for the Galaxy server when following the + # install_repositories_by_revision redirect, so we have to include 403 in the allowed HTTP # status codes and log in again. url = '%s/repository/install_repositories_by_revision?%s' % ( tool_shed_url, install_params ) self.visit_url( url, allowed_codes=[ 200, 403 ] ) self.logout() self.login( email='test@bx.psu.edu', username='test' ) - install_params = urllib.urlencode( dict( repository_ids=encoded_repository_id, + install_params = urllib.urlencode( dict( repository_ids=encoded_repository_id, changeset_revisions=changeset_revision, tool_shed_url=tool_shed_url ) ) url = '/admin_toolshed/prepare_for_install?%s' % install_params self.visit_url( url ) - # This section is tricky, due to the way twill handles form submission. The tool dependency checkbox needs to + # This section is tricky, due to the way twill handles form submission. The tool dependency checkbox needs to # be hacked in through tc.browser, putting the form field in kwd doesn't work. if 'install_tool_dependencies' in self.last_page(): form = tc.browser.get_form( 'select_tool_panel_section' ) @@ -105,12 +109,14 @@ self.check_for_strings( post_submit_strings_displayed, strings_not_displayed ) repository_ids = self.initiate_installation_process( new_tool_panel_section=new_tool_panel_section ) self.wait_for_repository_installation( repository_ids ) + def visit_url( self, url, allowed_codes=[ 200 ] ): new_url = tc.go( url ) return_code = tc.browser.get_code() assert return_code in allowed_codes, 'Invalid HTTP return code %s, allowed codes: %s' % \ - ( return_code, ', '.join( str( code ) for code in allowed_codes ) ) + ( return_code, ', '.join( str( code ) for code in allowed_codes ) ) return new_url + def wait_for_repository_installation( self, repository_ids ): final_states = [ model.ToolShedRepository.installation_status.ERROR, model.ToolShedRepository.installation_status.INSTALLED ] @@ -129,12 +135,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.fv ( 1, "remove_from_disk", 'false' ) tc.submit( 'deactivate_or_uninstall_repository_button' ) strings_displayed = [ 'The repository named' ] - strings_displayed.append( 'has been uninstalled' ) + strings_displayed.append( 'has been deactivated' ) self.check_for_strings( strings_displayed, strings_not_displayed=[] ) - 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