1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/1037ab5b4f76/ Changeset: 1037ab5b4f76 User: inithello Date: 2013-04-22 18:53:43 Summary: Tool shed functional tests for installation order with complex repository dependencies. Modified tests 0100 and 1100 to be less ambiguous regarding which repository contains what. Affected #: 8 files diff -r a8139a367ed3de938f5d71336a06f1f768132469 -r 1037ab5b4f761c104b01cf0aee9222d28a67034b test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -800,8 +800,12 @@ self.check_for_strings( strings_displayed, strings_not_displayed ) # 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. + form = tc.browser.get_form( 'select_tool_panel_section' ) + submit_button = 'select_tool_panel_section_button' + if form is None: + form = tc.browser.get_form( 'select_shed_tool_panel_config' ) + submit_button = 'select_shed_tool_panel_config_button' if 'install_tool_dependencies' in self.last_page(): - form = tc.browser.get_form( 'select_tool_panel_section' ) checkbox = form.find_control( id="install_tool_dependencies" ) checkbox.disabled = False if install_tool_dependencies: @@ -816,14 +820,10 @@ kwd[ 'shed_tool_conf' ] = self.shed_tool_conf if new_tool_panel_section: kwd[ 'new_tool_panel_section' ] = new_tool_panel_section - if includes_tools_for_display_in_tool_panel: - self.submit_form( 1, 'select_tool_panel_section_button', **kwd ) - self.check_for_strings( post_submit_strings_displayed, strings_not_displayed ) - else: - self.check_for_strings( strings_displayed=[ 'Choose the configuration file whose tool_path setting will be used for installing repositories' ] ) - args = dict( shed_tool_conf=self.shed_tool_conf ) - self.submit_form( 1, 'select_shed_tool_panel_config_button', **args ) - self.check_for_strings( post_submit_strings_displayed, strings_not_displayed ) + if not includes_tools_for_display_in_tool_panel: + self.check_for_strings( strings_displayed=[ 'Choose the configuration file' ] ) + self.submit_form( 1, submit_button, **kwd ) + 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 ) diff -r a8139a367ed3de938f5d71336a06f1f768132469 -r 1037ab5b4f761c104b01cf0aee9222d28a67034b test/tool_shed/functional/test_0100_complex_repository_dependencies.py --- a/test/tool_shed/functional/test_0100_complex_repository_dependencies.py +++ b/test/tool_shed/functional/test_0100_complex_repository_dependencies.py @@ -6,11 +6,11 @@ bwa_base_repository_name = 'bwa_base_repository_0100' bwa_base_repository_description = "BWA Base" -bwa_base_repository_long_description = "BWA tool that depends on bwa 0.5.9, with a complex repository dependency pointing at bwa_tool_repository_0100" +bwa_base_repository_long_description = "BWA tool that depends on bwa 0.5.9, with a complex repository dependency pointing at package_bwa_0_5_9_0100" -bwa_tool_repository_name = 'bwa_tool_repository_0100' -bwa_tool_repository_description = "BWA Tool" -bwa_tool_repository_long_description = "BWA repository with a package tool dependency defined for BWA 0.5.9." +bwa_package_repository_name = 'package_bwa_0_5_9_0100' +bwa_package_repository_description = "BWA Tool" +bwa_package_repository_long_description = "BWA repository with a package tool dependency defined for BWA 0.5.9." category_name = 'Test 0100 Complex Repository Dependencies' category_description = 'Test 0100 Complex Repository Dependencies' @@ -32,15 +32,15 @@ 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 ) - def test_0005_create_bwa_tool_repository( self ): - '''Create and populate bwa_tool_repository_0100.''' + def test_0005_create_bwa_package_repository( self ): + '''Create and populate package_bwa_0_5_9_0100.''' category = self.create_category( name=category_name, description=category_description ) self.logout() self.login( email=common.test_user_1_email, username=common.test_user_1_name ) - # Create a repository named bwa_tool_repository_0100 owned by user1. - repository = self.get_or_create_repository( name=bwa_tool_repository_name, - description=bwa_tool_repository_description, - long_description=bwa_tool_repository_long_description, + # Create a repository named package_bwa_0_5_9_0100 owned by user1. + repository = self.get_or_create_repository( name=bwa_package_repository_name, + description=bwa_package_repository_description, + long_description=bwa_package_repository_long_description, owner=common.test_user_1_name, category_id=self.security.encode_id( category.id ), strings_displayed=[] ) @@ -53,7 +53,7 @@ commit_message='Uploaded tool_dependencies.xml.', strings_displayed=[ 'The settings for <b>name</b>, <b>version</b> and <b>type</b> from a contained tool' ], strings_not_displayed=[] ) - # Visit the manage repository page for bwa_tool_repository_0100. + # Visit the manage repository page for package_bwa_0_5_9_0100. self.display_manage_repository_page( repository, strings_displayed=[ 'Tool dependencies', 'may not be', 'in this repository' ] ) def test_0010_create_bwa_base_repository( self ): @@ -85,10 +85,10 @@ xml_filename = self.get_filename( 'tool_dependencies.xml', filepath=dependency_path ) # The repository named bwa_base_repository_0100 is the dependent repository. base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - # The tool_repository named bwa_tool_repository_0100 is the required repository. - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + # The repository named package_bwa_0_5_9_0100 is the required repository. + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) url = 'http://http://this is not an url!' - name = 'bwa_tool_repository_0100' + name = 'package_bwa_0_5_9_0100' owner = 'user1' changeset_revision = self.get_repository_tip( tool_repository ) strings_displayed = [ 'Repository dependencies are currently supported only within the same tool shed' ] @@ -108,14 +108,14 @@ xml_filename = self.get_filename( 'tool_dependencies.xml', filepath=dependency_path ) # The base_repository named bwa_base_repository_0100 is the dependent repository. base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - # The tool_repository named bwa_tool_repository_0100 is the required repository. - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + # The repository named package_bwa_0_5_9_0100 is the required repository. + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) url = self.url name = 'invalid_repository!?' owner = 'user1' changeset_revision = self.get_repository_tip( tool_repository ) strings_displayed = [ 'because the name is invalid' ] - # Populate the dependent base_repository named bwa_tool_repository_0100 with an invalid tool_dependencies.xml file. + # Populate the dependent base_repository named package_bwa_0_5_9_0100 with an invalid tool_dependencies.xml file. repository_tuple = ( url, name, owner, changeset_revision ) self.create_repository_dependency( repository=base_repository, filepath=dependency_path, @@ -131,10 +131,10 @@ xml_filename = self.get_filename( 'tool_dependencies.xml', filepath=dependency_path ) # The base_repository named bwa_base_repository_0100 is the dependent repository. base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - # The tool_repository named bwa_tool_repository_0100 is the required repository. - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + # The repository named package_bwa_0_5_9_0100 is the required repository. + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) url = self.url - name = 'bwa_tool_repository_0100' + name = 'package_bwa_0_5_9_0100' owner = 'invalid_owner!?' changeset_revision = self.get_repository_tip( tool_repository ) strings_displayed = [ 'because the owner is invalid.' ] @@ -153,10 +153,10 @@ xml_filename = self.get_filename( 'tool_dependencies.xml', filepath=dependency_path ) # The base_repository named bwa_base_repository_0100 is the dependent repository. base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - # The tool_repository named bwa_tool_repository_0100 is the required repository. - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + # The repository named package_bwa_0_5_9_0100 is the required repository. + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) url = self.url - name = 'bwa_tool_repository_0100' + name = 'package_bwa_0_5_9_0100' owner = 'user1' changeset_revision = '1234abcd' strings_displayed = [ 'because the changeset revision is invalid.' ] @@ -170,14 +170,14 @@ version='0.5.9' ) def test_0035_generate_complex_repository_dependency( self ): - '''Generate and upload a valid tool_dependencies.xml file that specifies bwa_tool_repository_0100.''' + '''Generate and upload a valid tool_dependencies.xml file that specifies package_bwa_0_5_9_0100.''' # The base_repository named bwa_base_repository_0100 is the dependent repository. base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - # The tool_repository named bwa_tool_repository_0100 is the required repository. - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + # The repository named package_bwa_0_5_9_0100 is the required repository. + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) dependency_path = self.generate_temp_path( 'test_0100', additional_paths=[ 'complex' ] ) url = self.url - name = 'bwa_tool_repository_0100' + name = 'package_bwa_0_5_9_0100' owner = 'user1' changeset_revision = self.get_repository_tip( tool_repository ) repository_tuple = ( url, name, owner, changeset_revision ) @@ -194,8 +194,8 @@ '''Generate and upload a new tool_dependencies.xml file that specifies an arbitrary file on the filesystem, and verify that bwa_base depends on the new changeset revision.''' # The base_repository named bwa_base_repository_0100 is the dependent repository. base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - # The tool_repository named bwa_tool_repository_0100 is the required repository. - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + # The repository named package_bwa_0_5_9_0100 is the required repository. + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) previous_changeset = self.get_repository_tip( tool_repository ) old_tool_dependency = self.get_filename( os.path.join( 'bwa', 'complex', 'readme', 'tool_dependencies.xml' ) ) new_tool_dependency_path = self.generate_temp_path( 'test_1100', additional_paths=[ 'tool_dependency' ] ) @@ -220,12 +220,12 @@ self.display_manage_repository_page( tool_repository, strings_displayed=strings_displayed, strings_not_displayed=strings_not_displayed ) - # Visit the manage page of the bwa_tool_repository_0100 to confirm the valid tool dependency definition. + # Visit the manage page of the package_bwa_0_5_9_0100 to confirm the valid tool dependency definition. self.display_manage_repository_page( tool_repository, strings_displayed=strings_displayed, strings_not_displayed=strings_not_displayed ) # Visit the manage page of the bwa_base_repository_0100 to confirm the valid tool dependency definition - # and the updated changeset revision (updated tip) of the bwa_tool_repository_0100 repository is displayed + # and the updated changeset revision (updated tip) of the package_bwa_0_5_9_0100 repository is displayed # as the required repository revision. The original revision defined in the previously uploaded # tool_dependencies.xml file will be updated. self.display_manage_repository_page( base_repository, diff -r a8139a367ed3de938f5d71336a06f1f768132469 -r 1037ab5b4f761c104b01cf0aee9222d28a67034b test/tool_shed/functional/test_0170_complex_prior_installation_required.py --- /dev/null +++ b/test/tool_shed/functional/test_0170_complex_prior_installation_required.py @@ -0,0 +1,137 @@ +from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os +import tool_shed.base.test_db_util as test_db_util + +matplotlib_repository_name = 'package_matplotlib_1_2_0170' +matplotlib_repository_description = "Contains a tool dependency definition that downloads and compiles version 1.2.x of the the python matplotlib package." +matplotlib_repository_long_description = "This repository is intended to be defined as a complex repository dependency within a separate repository." + +numpy_repository_name = 'package_numpy_1_7_0170' +numpy_repository_description = "Contains a tool dependency definition that downloads and compiles version 1.7 of the the python numpy package." +numpy_repository_long_description = "This repository is intended to be defined as a complex repository dependency within a separate repository." + +category_name = 'Test 0170 Prior Installation Complex Dependencies' +category_description = 'Test 0170 Prior Installation Complex Dependencies' + +''' +1. Create and populate repositories package_matplotlib_1_2_0170 and package_numpy_1_7_0170. +2. Create a complex repository dependency on package_numpy_1_7_0170, and upload this to package_matplotlib_1_2_0170. +3. Verify that package_matplotlib_1_2_0170 now depends on package_numpy_1_7_0170, and that the inherited tool dependency displays correctly. +''' + + +class TestComplexPriorInstallation( ShedTwillTestCase ): + '''Test features related to datatype converters.''' + + def test_0000_initiate_users( self ): + """Create necessary user accounts.""" + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + test_user_1 = test_db_util.get_user( common.test_user_1_email ) + assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % test_user_1_email + test_user_1_private_role = test_db_util.get_private_role( test_user_1 ) + self.logout() + self.login( email=common.admin_email, username=common.admin_username ) + admin_user = test_db_util.get_user( common.admin_email ) + 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 ) + + def test_0005_create_matplotlib_repository( self ): + '''Create and populate the package_matplotlib_1_2_0170 repository.''' + ''' + This is step 1 - Create and populate repositories package_matplotlib_1_2_0170 and package_numpy_1_7_0170. + ''' + category = self.create_category( name=category_name, description=category_description ) + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + repository = self.get_or_create_repository( name=matplotlib_repository_name, + description=matplotlib_repository_description, + long_description=matplotlib_repository_long_description, + owner=common.test_user_1_name, + category_id=self.security.encode_id( category.id ), + strings_displayed=[] ) + self.upload_file( repository, + filename='package_matplotlib/package_matplotlib_1_2.tar', + filepath=None, + valid_tools_only=False, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded matplotlib tool dependency tarball.', + strings_displayed=['orphan'], + strings_not_displayed=[] ) + + def test_0010_create_numpy_repository( self ): + '''Create and populate the package_numpy_1_7_0170 repository.''' + ''' + This is step 1 - Create and populate repositories package_matplotlib_1_2_0170 and package_numpy_1_7_0170. + ''' + category = self.create_category( name=category_name, description=category_description ) + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + repository = self.get_or_create_repository( name=numpy_repository_name, + description=numpy_repository_description, + long_description=numpy_repository_long_description, + owner=common.test_user_1_name, + category_id=self.security.encode_id( category.id ), + strings_displayed=[] ) + self.upload_file( repository, + filename='package_numpy/package_numpy_1_7.tar', + filepath=None, + valid_tools_only=False, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded numpy tool dependency tarball.', + strings_displayed=['orphan'], + strings_not_displayed=[] ) + + def test_0015_create_complex_repository_dependency( self ): + '''Create a dependency on package_numpy_1_7_0170.''' + ''' + This is step 2 - Create a complex repository dependency on package_numpy_1_7_0170, and upload this to package_matplotlib_1_2_0170. + package_matplotlib_1_2_0170 should depend on package_numpy_1_7_0170, with prior_installation_required + set to True. When matplotlib is selected for installation, the result should be that numpy is compiled + and installed first. + ''' + numpy_repository = test_db_util.get_repository_by_name_and_owner( numpy_repository_name, common.test_user_1_name ) + matplotlib_repository = test_db_util.get_repository_by_name_and_owner( matplotlib_repository_name, common.test_user_1_name ) + # Generate the new dependency XML. Normally, the create_repository_dependency method would be used for this, but + # it replaces any existing tool or repository dependency XML file with the generated contents. This is undesirable + # in this case, because matplotlib already has an additional tool dependency definition that we don't want to + # overwrite. + new_xml = ' <package name="numpy" version="1.7">\n' + new_xml += ' <repository toolshed="%s" name="%s" owner="%s" changeset_revision="%s" prior_installation_required="True" />\n' + new_xml += ' </package>\n' + url = self.url + name = numpy_repository.name + owner = numpy_repository.user.username + changeset_revision = self.get_repository_tip( numpy_repository ) + processed_xml = new_xml % ( url, name, owner, changeset_revision ) + original_xml = file( self.get_filename( 'package_matplotlib/tool_dependencies.xml' ), 'r' ).read() + dependency_xml_path = self.generate_temp_path( 'test_0170', additional_paths=[ 'matplotlib' ] ) + new_xml_file = os.path.join( dependency_xml_path, 'tool_dependencies.xml' ) + file( new_xml_file, 'w' ).write( original_xml.replace( '<!--NUMPY-->', processed_xml ) ) + # Upload the generated complex repository dependency XML to the matplotlib repository. + self.upload_file( matplotlib_repository, + filename='tool_dependencies.xml', + filepath=dependency_xml_path, + valid_tools_only=True, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded complex repository dependency on numpy 1.7.', + strings_displayed=[], + strings_not_displayed=[] ) + + def test_0020_verify_generated_dependency( self ): + '''Verify that matplotlib now has a package tool dependency and a complex repository dependency.''' + ''' + This is step 3 - Verify that package_matplotlib_1_2_0170 now depends on package_numpy_1_7_0170, and that the inherited tool + dependency displays correctly. + 'Inhherited' in this case means that matplotlib should show a package tool dependency on numpy version 1.7, and a repository + dependency on the latest revision of package_numpy_1_7_0170. + ''' + numpy_repository = test_db_util.get_repository_by_name_and_owner( numpy_repository_name, common.test_user_1_name ) + matplotlib_repository = test_db_util.get_repository_by_name_and_owner( matplotlib_repository_name, common.test_user_1_name ) + changeset_revision = self.get_repository_tip( numpy_repository ) + self.check_repository_dependency( matplotlib_repository, depends_on_repository=numpy_repository ) + self.display_manage_repository_page( matplotlib_repository, strings_displayed=[ 'numpy', '1.7', 'package', changeset_revision ] ) + + \ No newline at end of file diff -r a8139a367ed3de938f5d71336a06f1f768132469 -r 1037ab5b4f761c104b01cf0aee9222d28a67034b test/tool_shed/functional/test_1100_install_repository_with_complex_dependencies.py --- a/test/tool_shed/functional/test_1100_install_repository_with_complex_dependencies.py +++ b/test/tool_shed/functional/test_1100_install_repository_with_complex_dependencies.py @@ -3,11 +3,11 @@ bwa_base_repository_name = 'bwa_base_repository_0100' bwa_base_repository_description = "BWA Base" -bwa_base_repository_long_description = "BWA tool that depends on bwa 0.5.9, with a complex repository dependency pointing at bwa_tool_repository_0100" +bwa_base_repository_long_description = "BWA tool that depends on bwa 0.5.9, with a complex repository dependency pointing at package_bwa_0_5_9_0100" -bwa_tool_repository_name = 'bwa_tool_repository_0100' -bwa_tool_repository_description = "BWA Tool" -bwa_tool_repository_long_description = "BWA repository with a package tool dependency defined for BWA 0.5.9." +bwa_package_repository_name = 'package_bwa_0_5_9_0100' +bwa_package_repository_description = "BWA Tool" +bwa_package_repository_long_description = "BWA repository with a package tool dependency defined to compile and install BWA 0.5.9." category_name = 'Test 0100 Complex Repository Dependencies' category_description = 'Test 0100 Complex Repository Dependencies' @@ -30,15 +30,15 @@ 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 ) - def test_0005_create_bwa_tool_repository( self ): + def test_0005_create_bwa_package_repository( self ): '''Create and populate bwa_tool_0100.''' global running_standalone category = self.create_category( name=category_name, description=category_description ) self.logout() self.login( email=common.test_user_1_email, username=common.test_user_1_name ) - repository = self.get_or_create_repository( name=bwa_tool_repository_name, - description=bwa_tool_repository_description, - long_description=bwa_tool_repository_long_description, + repository = self.get_or_create_repository( name=bwa_package_repository_name, + description=bwa_package_repository_description, + long_description=bwa_package_repository_long_description, owner=common.test_user_1_name, category_id=self.security.encode_id( category.id ), strings_displayed=[] ) @@ -73,7 +73,7 @@ owner=common.test_user_1_name, category_id=self.security.encode_id( category.id ), strings_displayed=[] ) - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) self.upload_file( repository, filename='bwa/complex/bwa_base.tar', filepath=None, @@ -91,7 +91,7 @@ dependency_path = self.generate_temp_path( 'test_0100', additional_paths=[ 'complex', 'shed' ] ) xml_filename = self.get_filename( 'tool_dependencies.xml', filepath=dependency_path ) base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) url = 'http://http://this is not an url!' name = tool_repository.name owner = tool_repository.user.username @@ -113,7 +113,7 @@ dependency_path = self.generate_temp_path( 'test_0100', additional_paths=[ 'complex', 'shed' ] ) xml_filename = self.get_filename( 'tool_dependencies.xml', filepath=dependency_path ) base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) url = self.url name = 'invalid_repository!?' owner = tool_repository.user.username @@ -135,7 +135,7 @@ dependency_path = self.generate_temp_path( 'test_0100', additional_paths=[ 'complex', 'shed' ] ) xml_filename = self.get_filename( 'tool_dependencies.xml', filepath=dependency_path ) base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) url = self.url name = tool_repository.name owner = 'invalid_owner!?' @@ -157,7 +157,7 @@ dependency_path = self.generate_temp_path( 'test_0100', additional_paths=[ 'complex', 'shed' ] ) xml_filename = self.get_filename( 'tool_dependencies.xml', filepath=dependency_path ) base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) url = self.url name = tool_repository.name owner = tool_repository.user.username @@ -173,11 +173,11 @@ version='0.5.9' ) def test_0035_generate_valid_complex_repository_dependency( self ): - '''Generate and upload a valid tool_dependencies.xml file that specifies bwa_tool_repository_0100.''' + '''Generate and upload a valid tool_dependencies.xml file that specifies package_bwa_0_5_9_0100.''' global running_standalone if running_standalone: base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) dependency_path = self.generate_temp_path( 'test_0100', additional_paths=[ 'complex' ] ) xml_filename = self.get_filename( 'tool_dependencies.xml', filepath=dependency_path ) url = self.url @@ -199,7 +199,7 @@ global running_standalone if running_standalone: base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) previous_changeset = self.get_repository_tip( tool_repository ) old_tool_dependency = self.get_filename( os.path.join( 'bwa', 'complex', 'readme', 'tool_dependencies.xml' ) ) new_tool_dependency_path = self.generate_temp_path( 'test_1100', additional_paths=[ 'tool_dependency' ] ) @@ -225,7 +225,7 @@ self.galaxy_logout() self.galaxy_login( email=common.admin_email, username=common.admin_username ) base_repository = test_db_util.get_repository_by_name_and_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_repository_by_name_and_owner( bwa_package_repository_name, common.test_user_1_name ) preview_strings_displayed = [ tool_repository.name, self.get_repository_tip( tool_repository ) ] self.install_repository( bwa_base_repository_name, common.test_user_1_name, @@ -238,19 +238,19 @@ def test_0050_verify_installed_repositories( self ): '''Verify that the installed repositories are displayed properly.''' base_repository = test_db_util.get_installed_repository_by_name_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_installed_repository_by_name_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_installed_repository_by_name_owner( bwa_package_repository_name, common.test_user_1_name ) strings_displayed = [ 'bwa_base_repository_0100', 'user1', base_repository.installed_changeset_revision ] - strings_displayed.extend( [ 'bwa_tool_repository_0100', 'user1', tool_repository.installed_changeset_revision ] ) + strings_displayed.extend( [ 'package_bwa_0_5_9_0100', 'user1', tool_repository.installed_changeset_revision ] ) strings_displayed.append( self.url.replace( 'http://', '' ) ) self.display_galaxy_browse_repositories_page( strings_displayed=strings_displayed, strings_not_displayed=[] ) - strings_displayed = [ 'bwa_tool_repository_0100', 'user1', tool_repository.installed_changeset_revision ] + strings_displayed = [ 'package_bwa_0_5_9_0100', 'user1', tool_repository.installed_changeset_revision ] strings_not_displayed = [ 'Missing tool dependencies' ] self.display_installed_repository_manage_page( tool_repository, strings_displayed=strings_displayed, strings_not_displayed=strings_not_displayed ) strings_displayed = [ 'bwa_base_repository_0100', 'user1', - 'bwa_tool_repository_0100', + 'package_bwa_0_5_9_0100', base_repository.installed_changeset_revision, tool_repository.installed_changeset_revision ] strings_not_displayed = [ 'Missing tool dependencies' ] @@ -261,7 +261,7 @@ def test_0055_verify_complex_tool_dependency( self ): '''Verify that the generated env.sh contains the right data.''' base_repository = test_db_util.get_installed_repository_by_name_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_installed_repository_by_name_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_installed_repository_by_name_owner( bwa_package_repository_name, common.test_user_1_name ) env_sh_path = os.path.join( self.galaxy_tool_dependency_dir, 'bwa', '0.5.9', @@ -274,17 +274,17 @@ if tool_repository.installed_changeset_revision not in contents: raise AssertionError( 'Installed changeset revision %s not found in env.sh.\nContents of env.sh: %s' % \ ( tool_repository.installed_changeset_revision, contents ) ) - if 'bwa_tool_repository_0100' not in contents: - raise AssertionError( 'Repository name bwa_tool_repository_0100 not found in env.sh.\nContents of env.sh: %s' % contents ) + if 'package_bwa_0_5_9_0100' not in contents: + raise AssertionError( 'Repository name package_bwa_0_5_9_0100 not found in env.sh.\nContents of env.sh: %s' % contents ) def test_0060_verify_tool_dependency_uninstallation( self ): - '''Uninstall the bwa_tool_repository_0100 repository.''' + '''Uninstall the package_bwa_0_5_9_0100 repository.''' ''' Uninstall the repository that defines an orphan tool dependency on BWA 0.5.9, and verify that this results in the compiled binary package also being removed. ''' base_repository = test_db_util.get_installed_repository_by_name_owner( bwa_base_repository_name, common.test_user_1_name ) - tool_repository = test_db_util.get_installed_repository_by_name_owner( bwa_tool_repository_name, common.test_user_1_name ) + tool_repository = test_db_util.get_installed_repository_by_name_owner( bwa_package_repository_name, common.test_user_1_name ) self.uninstall_repository( tool_repository, remove_from_disk=True ) env_sh_path = os.path.join( self.galaxy_tool_dependency_dir, 'bwa', diff -r a8139a367ed3de938f5d71336a06f1f768132469 -r 1037ab5b4f761c104b01cf0aee9222d28a67034b test/tool_shed/functional/test_1170_complex_prior_installation_required.py --- /dev/null +++ b/test/tool_shed/functional/test_1170_complex_prior_installation_required.py @@ -0,0 +1,181 @@ +from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os +import tool_shed.base.test_db_util as test_db_util + +matplotlib_repository_name = 'package_matplotlib_1_2_0170' +matplotlib_repository_description = "Contains a tool dependency definition that downloads and compiles version 1.2.x of the the python matplotlib package." +matplotlib_repository_long_description = "This repository is intended to be defined as a complex repository dependency within a separate repository." + +numpy_repository_name = 'package_numpy_1_7_0170' +numpy_repository_description = "Contains a tool dependency definition that downloads and compiles version 1.7 of the the python numpy package." +numpy_repository_long_description = "This repository is intended to be defined as a complex repository dependency within a separate repository." + +category_name = 'Test 0170 Prior Installation Complex Dependencies' +category_description = 'Test 0170 Prior Installation Complex Dependencies' + +''' +1. Create and populate repositories package_matplotlib_1_2_0170 and package_numpy_1_7_0170. +2. Create a complex repository dependency on package_numpy_1_7_0170, and upload this to package_matplotlib_1_2_0170. +3. Verify that package_matplotlib_1_2_0170 now depends on package_numpy_1_7_0170, and that the inherited tool dependency displays correctly. +4. Install package_matplotlib_1_2_0170 with repository dependencies. +5. Verify that the prior_installation_required attribute resulted in package_numpy_1_7_0170 being installed first. +''' + +running_standalone = False + + +class TestComplexPriorInstallation( ShedTwillTestCase ): + '''Test features related to datatype converters.''' + + def test_0000_initiate_users( self ): + """Create necessary user accounts.""" + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + test_user_1 = test_db_util.get_user( common.test_user_1_email ) + assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % test_user_1_email + test_user_1_private_role = test_db_util.get_private_role( test_user_1 ) + self.logout() + self.login( email=common.admin_email, username=common.admin_username ) + admin_user = test_db_util.get_user( common.admin_email ) + 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 ) + + def test_0005_create_matplotlib_repository( self ): + '''Create and populate the package_matplotlib_1_2_0170 repository.''' + ''' + This is step 1 - Create and populate repositories package_matplotlib_1_2_0170 and package_numpy_1_7_0170. + ''' + global running_standalone + category = self.create_category( name=category_name, description=category_description ) + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + repository = self.get_or_create_repository( name=matplotlib_repository_name, + description=matplotlib_repository_description, + long_description=matplotlib_repository_long_description, + owner=common.test_user_1_name, + category_id=self.security.encode_id( category.id ), + strings_displayed=[] ) + if self.repository_is_new( repository ): + running_standalone = True + self.upload_file( repository, + filename='package_matplotlib/package_matplotlib_1_2.tar', + filepath=None, + valid_tools_only=False, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded matplotlib tool dependency tarball.', + strings_displayed=['orphan'], + strings_not_displayed=[] ) + + def test_0010_create_numpy_repository( self ): + '''Create and populate the package_numpy_1_7_0170 repository.''' + ''' + This is step 1 - Create and populate repositories package_matplotlib_1_2_0170 and package_numpy_1_7_0170. + ''' + global running_standalone + category = self.create_category( name=category_name, description=category_description ) + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + if running_standalone: + repository = self.get_or_create_repository( name=numpy_repository_name, + description=numpy_repository_description, + long_description=numpy_repository_long_description, + owner=common.test_user_1_name, + category_id=self.security.encode_id( category.id ), + strings_displayed=[] ) + self.upload_file( repository, + filename='package_numpy/package_numpy_1_7.tar', + filepath=None, + valid_tools_only=False, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded numpy tool dependency tarball.', + strings_displayed=['orphan'], + strings_not_displayed=[] ) + + def test_0015_create_complex_repository_dependency( self ): + '''Create a dependency on package_numpy_1_7_0170.''' + ''' + This is step 2 - Create a complex repository dependency on package_numpy_1_7_0170, and upload this to package_matplotlib_1_2_0170. + package_matplotlib_1_2_0170 should depend on package_numpy_1_7_0170, with prior_installation_required + set to True. When matplotlib is selected for installation, the result should be that numpy is compiled + and installed first. + ''' + global running_standalone + numpy_repository = test_db_util.get_repository_by_name_and_owner( numpy_repository_name, common.test_user_1_name ) + matplotlib_repository = test_db_util.get_repository_by_name_and_owner( matplotlib_repository_name, common.test_user_1_name ) + # Generate the new dependency XML. Normally, the create_repository_dependency method would be used for this, but + # it replaces any existing tool or repository dependency XML file with the generated contents. This is undesirable + # in this case, because matplotlib already has an additional tool dependency definition that we don't want to + # overwrite. + new_xml = ' <package name="numpy" version="1.7">\n' + new_xml += ' <repository toolshed="%s" name="%s" owner="%s" changeset_revision="%s" prior_installation_required="True" />\n' + new_xml += ' </package>\n' + url = self.url + name = numpy_repository.name + owner = numpy_repository.user.username + if running_standalone: + changeset_revision = self.get_repository_tip( numpy_repository ) + processed_xml = new_xml % ( url, name, owner, changeset_revision ) + original_xml = file( self.get_filename( 'package_matplotlib/tool_dependencies.xml' ), 'r' ).read() + dependency_xml_path = self.generate_temp_path( 'test_0170', additional_paths=[ 'matplotlib' ] ) + new_xml_file = os.path.join( dependency_xml_path, 'tool_dependencies.xml' ) + file( new_xml_file, 'w' ).write( original_xml.replace( '<!--NUMPY-->', processed_xml ) ) + # Upload the generated complex repository dependency XML to the matplotlib repository. + self.upload_file( matplotlib_repository, + filename='tool_dependencies.xml', + filepath=dependency_xml_path, + valid_tools_only=True, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded complex repository dependency on numpy 1.7.', + strings_displayed=[], + strings_not_displayed=[] ) + + def test_0020_verify_generated_dependency( self ): + '''Verify that matplotlib now has a package tool dependency and a complex repository dependency.''' + ''' + This is step 3 - Verify that package_matplotlib_1_2_0170 now depends on package_numpy_1_7_0170, and that the inherited tool + dependency displays correctly. + 'Inhherited' in this case means that matplotlib should show a package tool dependency on numpy version 1.7, and a repository + dependency on the latest revision of package_numpy_1_7_0170. + ''' + numpy_repository = test_db_util.get_repository_by_name_and_owner( numpy_repository_name, common.test_user_1_name ) + matplotlib_repository = test_db_util.get_repository_by_name_and_owner( matplotlib_repository_name, common.test_user_1_name ) + changeset_revision = self.get_repository_tip( numpy_repository ) + self.check_repository_dependency( matplotlib_repository, depends_on_repository=numpy_repository ) + self.display_manage_repository_page( matplotlib_repository, strings_displayed=[ 'numpy', '1.7', 'package', changeset_revision ] ) + + def test_0025_install_matplotlib_repository( self ): + '''Install the package_matplotlib_1_2_0170 repository.''' + ''' + This is step 4 - Install package_matplotlib_1_2_0170 with repository dependencies. + ''' + self.galaxy_logout() + self.galaxy_login( email=common.admin_email, username=common.admin_username ) + matplotlib_repository = test_db_util.get_repository_by_name_and_owner( matplotlib_repository_name, common.test_user_1_name ) + preview_strings_displayed = [ 'package_matplotlib_1_2_0170', self.get_repository_tip( matplotlib_repository ) ] + strings_displayed = [ 'Choose the tool panel section' ] + self.install_repository( matplotlib_repository_name, + common.test_user_1_name, + category_name, + install_tool_dependencies=False, + install_repository_dependencies=True, + preview_strings_displayed=preview_strings_displayed, + strings_displayed=[], + strings_not_displayed=[], + post_submit_strings_displayed=[ 'package_matplotlib_1_2_0170', 'new' ], + includes_tools_for_display_in_tool_panel=False ) + + def test_0030_verify_installation_order( self ): + '''Verify that the numpy repository was installed before the matplotlib repository.''' + ''' + This is step 5 - Verify that the prior_installation_required attribute resulted in package_numpy_1_7_0170 being installed first. + In the previous step, package_matplotlib_1_2_0170 was selected for installation, but package_numpy_1_7_0170 had the + prior_installation_required attribute set. Confirm that this resulted in package_numpy_1_7_0170 being installed before + package_matplotlib_1_2_0170. + ''' + matplotlib_repository = test_db_util.get_installed_repository_by_name_owner( matplotlib_repository_name, common.test_user_1_name ) + numpy_repository = test_db_util.get_installed_repository_by_name_owner( numpy_repository_name, common.test_user_1_name ) + assert matplotlib_repository.update_time > numpy_repository.update_time, \ + 'Error: package_numpy_1_7_0170 shows a later update time than package_matplotlib_1_2_0170' + \ No newline at end of file diff -r a8139a367ed3de938f5d71336a06f1f768132469 -r 1037ab5b4f761c104b01cf0aee9222d28a67034b test/tool_shed/test_data/package_matplotlib/package_matplotlib_1_2.tar Binary file test/tool_shed/test_data/package_matplotlib/package_matplotlib_1_2.tar has changed diff -r a8139a367ed3de938f5d71336a06f1f768132469 -r 1037ab5b4f761c104b01cf0aee9222d28a67034b test/tool_shed/test_data/package_matplotlib/tool_dependencies.xml --- /dev/null +++ b/test/tool_shed/test_data/package_matplotlib/tool_dependencies.xml @@ -0,0 +1,25 @@ +<tool_dependency> +<!--NUMPY--> + <package name="matplotlib" version="1.2.1"> + <install version="1.0"> + <actions> + <action type="download_by_url">https://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.2.1/matplotlib-1.2.1.tar.gz</action> + <action type="shell_command">wget http://downloads.sourceforge.net/project/freetype/freetype2/2.4.11/freetype-2.4.11.tar.bz2</action> + <action type="shell_command">tar xfvj freetype-2.4.11.tar.bz2 && + cd freetype-2.4.11 && + ./configure --prefix=$INSTALL_DIR/freetype/build && + make && + make install</action> + <action type="make_directory">$INSTALL_DIR/lib/python</action> + <action type="shell_command">export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python && + export CPLUS_INCLUDE_PATH=$INSTALL_DIR/freetype/build/include:$INSTALL_DIR/freetype/build/include/freetype2/ && + export LIBRARY_PATH=$INSTALL_DIR/freetype/build/lib/ && + python setup.py install --home $INSTALL_DIR --install-scripts $INSTALL_DIR/bin</action> + <action type="set_environment"> + <environment_variable name="PYTHONPATH" action="append_to">$INSTALL_DIR/lib/python</environment_variable> + </action> + </actions> + </install> + <readme>Compiling matplotlib requires a C compiler (typically gcc), freetype2, numpy and libpng.</readme> + </package> +</tool_dependency> diff -r a8139a367ed3de938f5d71336a06f1f768132469 -r 1037ab5b4f761c104b01cf0aee9222d28a67034b test/tool_shed/test_data/package_numpy/package_numpy_1_7.tar Binary file test/tool_shed/test_data/package_numpy/package_numpy_1_7.tar has changed 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.