commit/galaxy-central: inithello: More tool shed functional test enhancements.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/512c7561e1b9/ changeset: 512c7561e1b9 user: inithello date: 2012-12-10 20:41:14 summary: More tool shed functional test enhancements. affected #: 8 files diff -r bd020b5aa5314718dbd7afe9e4e9e05bb3b53c7a -r 512c7561e1b95b381345296a0da3aa3effc05803 test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -15,6 +15,7 @@ self.hgweb_config_dir = os.environ.get( 'TEST_HG_WEB_CONFIG_DIR' ) self.hgweb_config_manager = galaxy.webapps.community.util.hgweb_config.HgWebConfigManager() self.hgweb_config_manager.hgweb_config_dir = self.hgweb_config_dir + self.tool_shed_test_tmp_dir = os.environ.get( 'TOOL_SHED_TEST_TMP_DIR', None) self.host = os.environ.get( 'TOOL_SHED_TEST_HOST' ) self.port = os.environ.get( 'TOOL_SHED_TEST_PORT' ) self.url = "http://%s:%s" % ( self.host, self.port ) @@ -213,6 +214,9 @@ string = string.replace( character, replacement ) return string def generate_repository_dependency_xml( self, repository, xml_filename, dependency_description='' ): + file_path = os.path.split( xml_filename )[0] + if not os.path.exists( file_path ): + os.makedirs( file_path ) changeset_revision = self.get_repository_tip( repository ) if dependency_description: description = ' description="%s"' % dependency_description @@ -226,6 +230,13 @@ description=description ) # Save the generated xml to the specified location. file( xml_filename, 'w' ).write( repository_dependency_xml ) + def generate_temp_path( self, test_script_path, additional_paths=[] ): + return os.path.join( self.tool_shed_test_tmp_dir, test_script_path, os.sep.join( additional_paths ) ) + def get_filename( self, filename, filepath=None ): + if filepath is not None: + return os.path.abspath( os.path.join( filepath, filename ) ) + else: + return os.path.abspath( os.path.join( self.file_dir, filename ) ) def get_latest_repository_metadata_for_repository( self, repository ): # TODO: This will not work as expected. Fix it. return repository.metadata_revisions[ 0 ] @@ -335,6 +346,7 @@ def upload_file( self, repository, filename, + filepath=None, valid_tools_only=True, strings_displayed=[], strings_not_displayed=[], @@ -344,6 +356,6 @@ strings_displayed.append( "has been successfully uploaded to the repository." ) for key in kwd: tc.fv( "1", key, kwd[ key ] ) - tc.formfile( "1", "file_data", self.get_filename( filename ) ) + tc.formfile( "1", "file_data", self.get_filename( filename, filepath ) ) tc.submit( "upload_button" ) self.check_for_strings( strings_displayed, strings_not_displayed ) diff -r bd020b5aa5314718dbd7afe9e4e9e05bb3b53c7a -r 512c7561e1b95b381345296a0da3aa3effc05803 test/tool_shed/functional/test_0000_basic_repository_features.py --- a/test/tool_shed/functional/test_0000_basic_repository_features.py +++ b/test/tool_shed/functional/test_0000_basic_repository_features.py @@ -1,7 +1,7 @@ from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os from tool_shed.base.test_db_util import get_repository_by_name_and_owner, get_user, get_private_role -repository_name = 'filtering' +repository_name = 'filtering_0000' repository_description = "Galaxy's filtering tool" repository_long_description = "Long description of Galaxy's filtering tool" @@ -19,41 +19,48 @@ assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email admin_user_private_role = get_private_role( admin_user ) def test_0005_create_categories( self ): - """Create categories""" - self.create_category( 'Text Manipulation', 'Tools for manipulating text' ) - self.create_category( 'Text Analysis', 'Tools for analyzing text' ) + """Create categories for this test suite""" + self.create_category( 'Test 0000 Basic Repository Features 1', 'Test 0000 Basic Repository Features 1' ) + self.create_category( 'Test 0000 Basic Repository Features 2', 'Test 0000 Basic Repository Features 2' ) def test_0010_create_repository( self ): """Create the filtering repository""" + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + test_user_1 = 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 = get_private_role( test_user_1 ) strings_displayed = [ 'Repository %s' % "'%s'" % repository_name, 'Repository %s has been created' % "'%s'" % repository_name ] self.create_repository( repository_name, repository_description, repository_long_description=repository_long_description, - categories=[ 'Text Manipulation' ], + categories=[ 'Test 0000 Basic Repository Features 1' ], strings_displayed=strings_displayed ) def test_0015_edit_repository( self ): """Edit the repository name, description, and long description""" - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) new_name = "renamed_filtering" new_description = "Edited filtering tool" new_long_description = "Edited long description" self.edit_repository_information( repository, repo_name=new_name, description=new_description, long_description=new_long_description ) def test_0020_change_repository_category( self ): """Change the categories associated with the filtering repository""" - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) - self.edit_repository_categories( repository, categories_to_add=[ "Text Analysis" ], categories_to_remove=[ "Text Manipulation" ] ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) + self.edit_repository_categories( repository, + categories_to_add=[ "Test 0000 Basic Repository Features 2" ], + categories_to_remove=[ "Test 0000 Basic Repository Features 1" ] ) def test_0025_grant_write_access( self ): '''Grant write access to another user''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) - self.grant_write_access( repository, usernames=[ common.test_user_1_name ] ) - self.revoke_write_access( repository, common.test_user_1_name ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) + self.grant_write_access( repository, usernames=[ common.admin_username ] ) + self.revoke_write_access( repository, common.admin_username ) def test_0030_upload_filtering_1_1_0( self ): """Upload filtering_1.1.0.tar to the repository""" - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, 'filtering/filtering_1.1.0.tar', commit_message="Uploaded filtering 1.1.0" ) def test_0035_verify_repository( self ): '''Display basic repository pages''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) latest_changeset_revision = self.get_repository_tip( repository ) self.check_for_valid_tools( repository, strings_displayed=[ 'Filter1' ] ) self.check_count_of_metadata_revisions_associated_with_repository( repository, metadata_count=1 ) @@ -61,16 +68,20 @@ self.check_repository_tools_for_changeset_revision( repository, tip ) self.check_repository_metadata( repository, tip_only=False ) self.browse_repository( repository, strings_displayed=[ 'Browse %s revision' % repository.name, '(repository tip)' ] ) - self.display_repository_clone_page( common.admin_username, + self.display_repository_clone_page( common.test_user_1_name, repository_name, strings_displayed=[ 'Uploaded filtering 1.1.0', latest_changeset_revision ] ) def test_0040_alter_repository_states( self ): '''Test toggling the malicious and deprecated repository flags.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) + self.logout() + self.login( email=common.admin_email, username=common.admin_username ) self.set_repository_malicious( repository, set_malicious=True, strings_displayed=[ 'The repository tip has been defined as malicious.' ] ) self.set_repository_malicious( repository, set_malicious=False, strings_displayed=[ 'The repository tip has been defined as <b>not</b> malicious.' ] ) + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) self.set_repository_deprecated( repository, strings_displayed=[ 'has been marked as deprecated', 'Mark as not deprecated' ] ) self.display_manage_repository_page( repository, @@ -82,7 +93,7 @@ set_deprecated=False ) def test_0045_display_repository_tip_file( self ): '''Display the contents of filtering.xml in the repository tip revision''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.display_repository_file_contents( repository=repository, filename='filtering.xml', filepath=None, @@ -90,16 +101,16 @@ strings_not_displayed=[] ) def test_0050_upload_filtering_txt_file( self ): '''Upload filtering.txt file associated with tool version 1.1.0.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, - 'filtering/filtering.txt', + 'filtering/filtering_0000.txt', commit_message="Uploaded filtering.txt", uncompress_file='No', remove_repo_files_not_in_tar='No' ) self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) def test_0055_upload_filtering_test_data( self ): '''Upload filtering test data.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, 'filtering/filtering_test_data.tar', commit_message="Uploaded filtering test data", remove_repo_files_not_in_tar='No' ) self.display_repository_file_contents( repository=repository, filename='1.bed', @@ -109,14 +120,14 @@ self.check_repository_metadata( repository, tip_only=True ) def test_0060_upload_filtering_2_2_0( self ): '''Upload filtering version 2.2.0''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, 'filtering/filtering_2.2.0.tar', commit_message="Uploaded filtering 2.2.0", remove_repo_files_not_in_tar='No' ) def test_0065_verify_filtering_repository( self ): '''Verify the new tool versions and repository metadata.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) tip = self.get_repository_tip( repository ) self.check_for_valid_tools( repository ) strings_displayed = self.get_repository_metadata_revisions( repository ).append( 'Select a revision' ) @@ -126,7 +137,7 @@ self.check_repository_metadata( repository, tip_only=False ) def test_0070_upload_readme_txt_file( self ): '''Upload readme.txt file associated with tool version 2.2.0.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, 'readme.txt', commit_message="Uploaded readme.txt" ) self.display_manage_repository_page( repository, strings_displayed=[ 'This is a readme file.' ] ) # Verify that there is a different readme file for each metadata revision. @@ -134,13 +145,13 @@ self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0', 'This is a readme file.' ] ) def test_0075_delete_readme_txt_file( self ): '''Delete the readme.txt file.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.delete_files_from_repository( repository, filenames=[ 'readme.txt' ] ) self.check_count_of_metadata_revisions_associated_with_repository( repository, metadata_count=2 ) self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) def test_0080_search_for_valid_filter_tool( self ): '''Search for the filtering tool by tool ID, name, and version.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) tip_changeset = self.get_repository_tip( repository ) search_fields = dict( tool_id='Filter1', tool_name='filter', tool_version='2.2.0' ) self.search_for_valid_tools( search_fields=search_fields, strings_displayed=[ tip_changeset ], strings_not_displayed=[] ) diff -r bd020b5aa5314718dbd7afe9e4e9e05bb3b53c7a -r 512c7561e1b95b381345296a0da3aa3effc05803 test/tool_shed/functional/test_0010_repository_with_tool_dependencies.py --- a/test/tool_shed/functional/test_0010_repository_with_tool_dependencies.py +++ b/test/tool_shed/functional/test_0010_repository_with_tool_dependencies.py @@ -1,7 +1,7 @@ from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os from tool_shed.base.test_db_util import get_repository_by_name_and_owner, get_user, get_private_role -repository_name = 'freebayes' +repository_name = 'freebayes_0010' repository_description = "Galaxy's freebayes tool" repository_long_description = "Long description of Galaxy's freebayes tool" @@ -10,21 +10,28 @@ def test_0000_create_or_login_admin_user( self ): """Create necessary user accounts and login as an admin user.""" self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + test_user_1 = 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 = get_private_role( test_user_1 ) + self.logout() self.login( email=common.admin_email, username=common.admin_username ) admin_user = 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 = get_private_role( admin_user ) def test_0005_create_category( self ): - """Create SNP Analysis category.""" - self.create_category( 'SNP Analysis', 'Tools for single nucleotide polymorphism data such as WGA' ) + """Create a category for this test suite""" + self.create_category( 'Test 0010 Repository With Tool Dependencies', 'Tests for a repository with tool dependencies.' ) def test_0010_create_freebayes_repository_and_upload_tool_xml( self ): '''Create freebayes repository and upload freebayes.xml without tool_data_table_conf.xml.sample. This should result in an error message and invalid tool.''' + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) self.create_repository( repository_name, repository_description, repository_long_description=repository_long_description, - categories=[ 'SNP Analysis' ], + categories=[ 'Test 0010 Repository With Tool Dependencies' ], strings_displayed=[] ) - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, 'freebayes/freebayes.xml', valid_tools_only=False, @@ -37,7 +44,7 @@ strings_displayed=[ 'requires an entry', 'tool_data_table_conf.xml' ] ) def test_0015_upload_missing_tool_data_table_conf_file( self ): '''Upload the missing tool_data_table_conf.xml.sample file to the repository.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, 'freebayes/tool_data_table_conf.xml.sample', valid_tools_only=False, @@ -50,27 +57,27 @@ strings_displayed=[ 'refers to a file', 'sam_fa_indices.loc' ] ) def test_0020_upload_missing_sample_loc_file( self ): '''Upload the missing sam_fa_indices.loc.sample file to the repository.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, 'freebayes/sam_fa_indices.loc.sample', strings_displayed=[], commit_message='Uploaded tool data table .loc file.' ) def test_0025_upload_invalid_tool_dependency_xml( self ): '''Upload tool_dependencies.xml defining version 0.9.5 of the freebayes package.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, os.path.join( 'freebayes', 'invalid_tool_dependencies', 'tool_dependencies.xml' ), strings_displayed=[ 'Name, version and type from a tool requirement tag does not match' ], commit_message='Uploaded invalid tool dependency XML.' ) def test_0030_upload_valid_tool_dependency_xml( self ): '''Upload tool_dependencies.xml defining version 0.9.4_9696d0ce8a962f7bb61c4791be5ce44312b81cf8 of the freebayes package.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, os.path.join( 'freebayes', 'tool_dependencies.xml' ), commit_message='Uploaded valid tool dependency XML.' ) def test_0035_verify_tool_dependencies( self ): '''Verify that the uploaded tool_dependencies.xml specifies the correct package versions.''' - repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.display_manage_repository_page( repository, strings_displayed=[ 'freebayes', '0.9.4_9696d0ce8a9', 'samtools', '0.1.18', 'Valid tools' ], strings_not_displayed=[ 'Invalid tools' ] ) diff -r bd020b5aa5314718dbd7afe9e4e9e05bb3b53c7a -r 512c7561e1b95b381345296a0da3aa3effc05803 test/tool_shed/functional/test_0020_basic_repository_dependencies.py --- a/test/tool_shed/functional/test_0020_basic_repository_dependencies.py +++ b/test/tool_shed/functional/test_0020_basic_repository_dependencies.py @@ -1,7 +1,7 @@ from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os from tool_shed.base.test_db_util import get_repository_by_name_and_owner, get_user, get_private_role -datatypes_repository_name = 'emboss_datatypes' +datatypes_repository_name = 'emboss_datatypes_0020' datatypes_repository_description = "Galaxy applicable data formats used by Emboss tools." datatypes_repository_long_description = "Galaxy applicable data formats used by Emboss tools. This repository contains no tools." @@ -14,20 +14,18 @@ def test_0000_initiate_users( self ): """Create necessary user accounts and login as an admin user.""" self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + test_user_1 = get_user( common.test_user_1_email ) + assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_1_email + test_user_1_private_role = get_private_role( test_user_1 ) + self.logout() self.login( email=common.admin_email, username=common.admin_username ) admin_user = get_user( common.admin_email ) assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email admin_user_private_role = get_private_role( admin_user ) - self.logout() - self.login( email=common.test_user_1_email, username=common.test_user_1_name ) - test_user_1 = get_user( common.test_user_1_email ) - assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_1_email - test_user_1_private_role = get_private_role( test_user_1 ) def test_0005_create_category( self ): - """Create Sequence Analysis category""" - self.logout() - self.login( email=common.admin_email, username=common.admin_username ) - self.create_category( 'Sequence Analysis', 'Tools for performing Protein and DNA/RNA analysis' ) + """Create a category for this test suite""" + self.create_category( 'Test 0020 Basic Repository Dependencies', 'Testing basic repository dependency features.' ) def test_0010_create_emboss_datatypes_repository_and_upload_tarball( self ): '''Create and populate the emboss_datatypes repository.''' self.logout() @@ -35,7 +33,7 @@ self.create_repository( datatypes_repository_name, datatypes_repository_description, repository_long_description=datatypes_repository_long_description, - categories=[ 'Sequence Analysis' ], + categories=[ 'Test 0020 Basic Repository Dependencies' ], strings_displayed=[] ) repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) self.upload_file( repository, 'emboss/datatypes/datatypes_conf.xml', commit_message='Uploaded datatypes_conf.xml.' ) @@ -48,7 +46,7 @@ self.create_repository( emboss_repository_name, emboss_repository_description, repository_long_description=emboss_repository_long_description, - categories=[ 'Text Manipulation' ], + categories=[ 'Test 0020 Basic Repository Dependencies' ], strings_displayed=[] ) repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) self.upload_file( repository, 'emboss/emboss.tar', commit_message='Uploaded emboss_5.tar' ) @@ -56,8 +54,13 @@ '''Generate and upload the repository_dependencies.xml file''' repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) - self.generate_repository_dependency_xml( datatypes_repository, self.get_filename( 'emboss/5/repository_dependencies.xml' ) ) - self.upload_file( repository, 'emboss/5/repository_dependencies.xml', commit_message='Uploaded repository_dependencies.xml' ) + repository_dependencies_path = self.generate_temp_path( 'test_0020', additional_paths=[ 'emboss', '5' ] ) + self.generate_repository_dependency_xml( datatypes_repository, + self.get_filename( 'repository_dependencies.xml', filepath=repository_dependencies_path ) ) + self.upload_file( repository, + 'repository_dependencies.xml', + filepath=repository_dependencies_path, + commit_message='Uploaded repository_dependencies.xml' ) def test_0030_verify_emboss_5_repository_dependency_on_emboss_datatypes( self ): '''Verify that the emboss_5 repository now depends on the emboss_datatypes repository with correct name, owner, and changeset revision.''' repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) @@ -65,7 +68,3 @@ changeset_revision = self.get_repository_tip( datatypes_repository ) strings_displayed = [ datatypes_repository_name, common.test_user_1_name, changeset_revision, 'Repository dependencies' ] self.display_manage_repository_page( repository, strings_displayed=strings_displayed ) - def test_0035_cleanup( self ): - '''Clean up generated test data.''' - if os.path.exists( self.get_filename( 'emboss/5/repository_dependencies.xml' ) ): - os.remove( self.get_filename( 'emboss/5/repository_dependencies.xml' ) ) diff -r bd020b5aa5314718dbd7afe9e4e9e05bb3b53c7a -r 512c7561e1b95b381345296a0da3aa3effc05803 test/tool_shed/functional/test_0030_repository_dependency_revisions.py --- a/test/tool_shed/functional/test_0030_repository_dependency_revisions.py +++ b/test/tool_shed/functional/test_0030_repository_dependency_revisions.py @@ -5,7 +5,7 @@ datatypes_repository_description = "Galaxy applicable data formats used by Emboss tools." datatypes_repository_long_description = "Galaxy applicable data formats used by Emboss tools. This repository contains no tools." -emboss_repository_name = 'emboss' +emboss_repository_name = 'emboss_0030' emboss_5_repository_name = 'emboss_5_0030' emboss_6_repository_name = 'emboss_6_0030' emboss_repository_description = 'Galaxy wrappers for Emboss version 5.0.0 tools' @@ -13,38 +13,31 @@ class TestRepositoryDependencyRevisions( ShedTwillTestCase ): '''Test dependencies on different revisions of a repository.''' - ''' - create repository emboss_5_0030 - create repository emboss_6_0030 - create repository emboss_datatypes if necessary - create repository emboss - emboss_5 has repository_dependency.xml file that defines emboss_datatypes - emboss_6 has repository_dependency.xml file that defines emboss_datatypes - get information to create repository dependency imformation for emboss - emboss depends on emboss_5 - then emboss depends on emboss_6 - verify per-changeset dependencies - ''' 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 = get_user( common.test_user_1_email ) + assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % regular_email + test_user_1_private_role = get_private_role( test_user_1 ) + self.logout() self.login( email=common.admin_email, username=common.admin_username ) admin_user = 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 = get_private_role( admin_user ) + def test_0005_create_category( self ): + """Create a category for this test suite""" + self.create_category( 'Test 0030 Repository Dependency Revisions', 'Testing repository dependencies by revision.' ) + def test_0005_create_repositories( self ): + '''Create the emboss_5_0030, emboss_6_0030, emboss_datatypes, and emboss repositories and populate the emboss_datatypes repository.''' self.logout() self.login( email=common.test_user_1_email, username=common.test_user_1_name ) - test_user_1 = get_user( common.test_user_1_email ) - assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % regular_email - test_user_1_private_role = get_private_role( test_user_1 ) - def test_0005_create_repositories( self ): - '''Create the emboss_5_0030, emboss_6_0030, emboss_datatypes, and emboss repositories and populate the emboss_datatypes repository.''' emboss_5_repository = get_repository_by_name_and_owner( emboss_5_repository_name, common.test_user_1_name ) if emboss_5_repository is None: self.create_repository( emboss_5_repository_name, emboss_repository_description, repository_long_description=emboss_repository_long_description, - categories=[ 'Sequence Analysis' ], + categories=[ 'Test 0030 Repository Dependency Revisions' ], strings_displayed=[] ) emboss_5_repository = get_repository_by_name_and_owner( emboss_5_repository_name, common.test_user_1_name ) self.upload_file( emboss_5_repository, 'emboss/emboss.tar', commit_message='Uploaded tool tarball.' ) @@ -53,7 +46,7 @@ self.create_repository( emboss_6_repository_name, emboss_repository_description, repository_long_description=emboss_repository_long_description, - categories=[ 'Sequence Analysis' ], + categories=[ 'Test 0030 Repository Dependency Revisions' ], strings_displayed=[] ) emboss_6_repository = get_repository_by_name_and_owner( emboss_6_repository_name, common.test_user_1_name ) self.upload_file( emboss_6_repository, 'emboss/emboss.tar', commit_message='Uploaded tool tarball..' ) @@ -62,7 +55,7 @@ self.create_repository( datatypes_repository_name, datatypes_repository_description, repository_long_description=datatypes_repository_long_description, - categories=[ 'Sequence Analysis' ], + categories=[ 'Test 0030 Repository Dependency Revisions' ], strings_displayed=[] ) datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) if self.repository_is_new( datatypes_repository ): @@ -72,45 +65,56 @@ self.create_repository( emboss_repository_name, emboss_repository_description, repository_long_description=emboss_repository_long_description, - categories=[ 'Sequence Analysis' ], + categories=[ 'Test 0030 Repository Dependency Revisions' ], strings_displayed=[] ) emboss_repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) self.upload_file( emboss_5_repository, 'emboss/emboss.tar', commit_message='Uploaded tool tarball.' ) def test_0010_generate_repository_dependencies_for_emboss_5( self ): '''Generate a repository_dependencies.xml file specifying emboss_datatypes and upload it to the emboss_5 repository.''' datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) - self.generate_repository_dependency_xml( datatypes_repository, self.get_filename( 'emboss/repository_dependencies.xml' ) ) + repository_dependencies_path = self.generate_temp_path( 'test_0030', additional_paths=[ 'emboss' ] ) + self.generate_repository_dependency_xml( datatypes_repository, + self.get_filename( 'repository_dependencies.xml', filepath=repository_dependencies_path ) ) emboss_5_repository = get_repository_by_name_and_owner( emboss_5_repository_name, common.test_user_1_name ) - self.upload_file( emboss_5_repository, 'emboss/repository_dependencies.xml', commit_message='Uploaded repository_depepndencies.xml.' ) + self.upload_file( emboss_5_repository, + 'repository_dependencies.xml', + filepath=repository_dependencies_path, + commit_message='Uploaded repository_depepndencies.xml.' ) def test_0015_generate_repository_dependencies_for_emboss_6( self ): '''Generate a repository_dependencies.xml file specifying emboss_datatypes and upload it to the emboss_6 repository.''' emboss_6_repository = get_repository_by_name_and_owner( emboss_6_repository_name, common.test_user_1_name ) - self.upload_file( emboss_6_repository, 'emboss/repository_dependencies.xml', commit_message='Uploaded repository_depepndencies.xml.' ) + repository_dependencies_path = self.generate_temp_path( 'test_0030', additional_paths=[ 'emboss' ] ) + self.upload_file( emboss_6_repository, + 'repository_dependencies.xml', + filepath=repository_dependencies_path, + commit_message='Uploaded repository_depepndencies.xml.' ) def test_0020_generate_repository_dependency_on_emboss_5( self ): '''Create and upload repository_dependencies.xml for the emboss_5_0030 repository.''' emboss_repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) emboss_5_repository = get_repository_by_name_and_owner( emboss_5_repository_name, common.test_user_1_name ) + repository_dependencies_path = self.generate_temp_path( 'test_0030', additional_paths=[ 'emboss', '5' ] ) self.generate_repository_dependency_xml( emboss_5_repository, - self.get_filename( 'emboss/5/repository_dependencies.xml' ), + self.get_filename( 'repository_dependencies.xml', filepath=repository_dependencies_path ), dependency_description='Emboss requires the Emboss 5 repository.' ) self.upload_file( emboss_repository, - 'emboss/5/repository_dependencies.xml', + 'repository_dependencies.xml', + filepath=repository_dependencies_path, commit_message='Uploaded dependency configuration specifying emboss_5' ) def test_0025_generate_repository_dependency_on_emboss_6( self ): '''Create and upload repository_dependencies.xml for the emboss_6_0030 repository.''' emboss_repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) emboss_6_repository = get_repository_by_name_and_owner( emboss_6_repository_name, common.test_user_1_name ) + repository_dependencies_path = self.generate_temp_path( 'test_0030', additional_paths=[ 'emboss', '6' ] ) self.generate_repository_dependency_xml( emboss_6_repository, - self.get_filename( 'emboss/6/repository_dependencies.xml' ), + self.get_filename( 'repository_dependencies.xml', filepath=repository_dependencies_path ), dependency_description='Emboss requires the Emboss 6 repository.' ) self.upload_file( emboss_repository, - 'emboss/6/repository_dependencies.xml', + 'repository_dependencies.xml', + filepath=repository_dependencies_path, commit_message='Uploaded dependency configuration specifying emboss_6' ) def test_0030_verify_repository_dependency_revisions( self ): '''Verify that different metadata revisions of the emboss repository have different repository dependencies.''' repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) - # Reset emboss metadata to pick up the repository dependency changes. -# self.reset_repository_metadata( repository ) repository_metadata = [ ( metadata.metadata, metadata.changeset_revision ) for metadata in self.get_repository_metadata( repository ) ] datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) datatypes_tip = self.get_repository_tip( datatypes_repository ) @@ -127,8 +131,3 @@ self.display_manage_repository_page( repository, changeset_revision=changeset_revision, strings_displayed=[ str( metadata ) for metadata in repository_dependency_metadata ] ) - def test_0035_cleanup( self ): - '''Clean up generated repository dependency XML files.''' - for filename in [ 'emboss/5/repository_dependencies.xml', 'emboss/6/repository_dependencies.xml', 'emboss/repository_dependencies.xml' ]: - if os.path.exists( self.get_filename( filename ) ): - os.remove( self.get_filename( filename ) ) diff -r bd020b5aa5314718dbd7afe9e4e9e05bb3b53c7a -r 512c7561e1b95b381345296a0da3aa3effc05803 test/tool_shed/functional_tests.py --- a/test/tool_shed/functional_tests.py +++ b/test/tool_shed/functional_tests.py @@ -10,6 +10,7 @@ # the hgweb.config file, the database, new repositories, etc. Since the tool shed browses repository contents via HTTP, # the full path to the temporary directroy wher eht repositories are located cannot contain invalid url characters. tool_shed_test_tmp_dir = os.path.join( tool_shed_home_directory, 'tmp' ) +os.environ[ 'TOOL_SHED_TEST_TMP_DIR' ] = tool_shed_test_tmp_dir new_path = [ os.path.join( cwd, "lib" ) ] new_path.extend( sys.path[1:] ) sys.path = new_path @@ -270,7 +271,7 @@ for dir in [ tool_shed_test_tmp_dir ]: if os.path.exists( dir ): log.info( "Cleaning up temporary files in %s" % dir ) - #shutil.rmtree( dir ) + shutil.rmtree( dir ) except: pass if success: diff -r bd020b5aa5314718dbd7afe9e4e9e05bb3b53c7a -r 512c7561e1b95b381345296a0da3aa3effc05803 test/tool_shed/test_data/filtering/filtering.txt --- a/test/tool_shed/test_data/filtering/filtering.txt +++ /dev/null @@ -1,1 +0,0 @@ -Readme file for filtering 1.1.0 diff -r bd020b5aa5314718dbd7afe9e4e9e05bb3b53c7a -r 512c7561e1b95b381345296a0da3aa3effc05803 test/tool_shed/test_data/filtering/filtering_0000.txt --- /dev/null +++ b/test/tool_shed/test_data/filtering/filtering_0000.txt @@ -0,0 +1,1 @@ +Readme file for filtering 1.1.0 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)
-
Bitbucket