1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/1b0c9587a1da/ Changeset: 1b0c9587a1da User: inithello Date: 2014-01-02 21:29:13 Summary: Clean up and fix tool shed functional test script 1300. Affected #: 1 file
diff -r 809b87af4983e40382d16f4f1a72896328d84f5e -r 1b0c9587a1da4adc4b75f843f10191e7136cf719 test/tool_shed/functional/test_1300_reset_all_metadata.py --- a/test/tool_shed/functional/test_1300_reset_all_metadata.py +++ b/test/tool_shed/functional/test_1300_reset_all_metadata.py @@ -1,4 +1,5 @@ from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os + 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." @@ -6,6 +7,29 @@ emboss_repository_long_description = 'Galaxy wrappers for Emboss version 5.0.0 tools' workflow_filename = 'Workflow_for_0060_filter_workflow_repository.ga' workflow_name = 'Workflow for 0060_filter_workflow_repository' +filtering_repository_description = "Galaxy's filtering tool for test 0040" +filtering_repository_long_description = "Long description of Galaxy's filtering tool for test 0040" + +category_0000_name='Test 0000 Basic Repository Features 1' +category_0001_name='Test 0000 Basic Repository Features 2' +category_0010_name='Test 0010 Repository With Tool Dependencies' +category_0020_name='Test 0020 Basic Repository Dependencies' +category_0030_name='Test 0030 Repository Dependency Revisions' +category_0040_name='test_0040_repository_circular_dependencies' +category_0050_name='test_0050_repository_n_level_circular_dependencies' +category_0060_name='Test 0060 Workflow Features' + +''' +This script will run in one of two possible ways: + +1. Directly, by calling sh run_functional_tests.sh -toolshed test/tool_shed/functional/test_1300_reset_all_metadata.py. + -OR- +2. After the previous test scripts have completed. + +In the first case, it is desirable to have the Galaxy database in a state that is as close as possible to the state it would +be in following the second case. This means explicitly installing whatever repositories would be in an installed state following +the previous test scripts. +'''
base_datatypes_count = 0 repository_datatypes_count = 0 @@ -14,6 +38,7 @@
class TestResetInstalledRepositoryMetadata( ShedTwillTestCase ): '''Verify that the "Reset selected metadata" feature works.''' + def test_0000_initiate_users( self ): """Create necessary user accounts.""" self.logout() @@ -26,92 +51,108 @@ admin_user = self.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 = self.test_db_util.get_private_role( admin_user ) - def test_0005_create_repositories_and_categories( self ): - '''Ensure that the necessary categories and repositories exist for these tests.''' + + def test_0005_create_categories( self ): + '''Create the categories for the repositories in this test script.''' + self.logout() + self.login( email=common.admin_email, username=common.admin_username ) + category_0000 = self.create_category( name=category_0000_name, description='Test 0000 Basic Repository Features 1' ) + category_0001 = self.create_category( name=category_0001_name, description='Test 0000 Basic Repository Features 2' ) + category_0010 = self.create_category( name=category_0010_name, description='Tests for a repository with tool dependencies.' ) + category_0020 = self.create_category( name=category_0020_name, description='Testing basic repository dependency features.' ) + category_0030 = self.create_category( name=category_0030_name, description='Testing repository dependencies by revision.' ) + category_0040 = self.create_category( name=category_0040_name, description='Testing handling of circular repository dependencies.' ) + category_0050 = self.create_category( name=category_0050_name, description='Testing handling of circular repository dependencies to n levels.' ) + category_0060 = self.create_category( name=category_0060_name, description='Test 0060 - Workflow Features' ) + + def test_0010_create_repositories_from_0000_series( self ): + '''Create repository filtering_0000 if necessary.''' global repository_datatypes_count global running_standalone - category_0000 = self.create_category( name='Test 0000 Basic Repository Features 1', description='Test 0000 Basic Repository Features 1' ) - category_0001 = self.create_category( name='Test 0000 Basic Repository Features 2', description='Test 0000 Basic Repository Features 2' ) - category_0010 = self.create_category( name='Test 0010 Repository With Tool Dependencies', description='Tests for a repository with tool dependencies.' ) - category_0020 = self.create_category( name='Test 0020 Basic Repository Dependencies', description='Testing basic repository dependency features.' ) - category_0030 = self.create_category( name='Test 0030 Repository Dependency Revisions', description='Testing repository dependencies by revision.' ) - category_0040 = self.create_category( name='test_0040_repository_circular_dependencies', description='Testing handling of circular repository dependencies.' ) - category_0050 = self.create_category( name='test_0050_repository_n_level_circular_dependencies', description='Testing handling of circular repository dependencies to n levels.' ) - category_0060 = self.create_category( name='Test 0060 Workflow Features', description='Test 0060 - Workflow Features' ) self.logout() self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + category = self.create_category( name=category_0000_name, description='' ) repository = self.get_or_create_repository( name='filtering_0000', description="Galaxy's filtering tool", long_description="Long description of Galaxy's filtering tool", owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0000.id ) ) + category_id=self.security.encode_id( category.id ) ) if self.repository_is_new( repository ): - self.upload_file( repository, - filename='filtering/filtering_1.1.0.tar', - filepath=None, - valid_tools_only=True, - uncompress_file=True, - remove_repo_files_not_in_tar=False, - commit_message='Uploaded filtering 1.1.0 tarball.', - strings_displayed=[], - strings_not_displayed=[] ) - self.upload_file( repository, - filename='filtering/filtering_2.2.0.tar', - filepath=None, - valid_tools_only=True, - uncompress_file=True, - remove_repo_files_not_in_tar=False, - commit_message='Uploaded filtering 2.2.0 tarball.', - strings_displayed=[], - strings_not_displayed=[] ) + running_standalone = True + self.upload_file( repository, + filename='filtering/filtering_1.1.0.tar', + filepath=None, + valid_tools_only=True, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded filtering 1.1.0 tarball.', + strings_displayed=[], + strings_not_displayed=[] ) + self.upload_file( repository, + filename='filtering/filtering_2.2.0.tar', + filepath=None, + valid_tools_only=True, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded filtering 2.2.0 tarball.', + strings_displayed=[], + strings_not_displayed=[] ) + + def test_0015_create_repositories_from_0010_series( self ): + '''Create repository freebayes_0010.''' + category = self.create_category( name=category_0010_name, description='' ) repository = self.get_or_create_repository( name='freebayes_0010', description="Galaxy's freebayes tool", long_description="Long description of Galaxy's freebayes tool", owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0010.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) if self.repository_is_new( repository ): - self.upload_file( repository, - filename='freebayes/freebayes.xml', - filepath=None, - valid_tools_only=False, - uncompress_file=True, - remove_repo_files_not_in_tar=False, - commit_message='Uploaded freebayes.xml.', - strings_displayed=[], - strings_not_displayed=[] ) - self.upload_file( repository, - filename='freebayes/tool_data_table_conf.xml.sample', - filepath=None, - valid_tools_only=False, - uncompress_file=True, - remove_repo_files_not_in_tar=False, - commit_message='Uploaded tool_data_table_conf.xml.sample', - strings_displayed=[], - strings_not_displayed=[] ) - self.upload_file( repository, - filename='freebayes/sam_fa_indices.loc.sample', - filepath=None, - valid_tools_only=False, - uncompress_file=True, - remove_repo_files_not_in_tar=False, - commit_message='Uploaded sam_fa_indices.loc.sample', - strings_displayed=[], - strings_not_displayed=[] ) - self.upload_file( repository, - filename='freebayes/tool_dependencies.xml', - filepath=None, - valid_tools_only=False, - uncompress_file=True, - remove_repo_files_not_in_tar=False, - commit_message='Uploaded tool_dependencies.xml', - strings_displayed=[], - strings_not_displayed=[] ) + self.upload_file( repository, + filename='freebayes/freebayes.xml', + filepath=None, + valid_tools_only=False, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded freebayes.xml.', + strings_displayed=[], + strings_not_displayed=[] ) + self.upload_file( repository, + filename='freebayes/tool_data_table_conf.xml.sample', + filepath=None, + valid_tools_only=False, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded tool_data_table_conf.xml.sample', + strings_displayed=[], + strings_not_displayed=[] ) + self.upload_file( repository, + filename='freebayes/sam_fa_indices.loc.sample', + filepath=None, + valid_tools_only=False, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded sam_fa_indices.loc.sample', + strings_displayed=[], + strings_not_displayed=[] ) + self.upload_file( repository, + filename='freebayes/tool_dependencies.xml', + filepath=None, + valid_tools_only=False, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Uploaded tool_dependencies.xml', + strings_displayed=[], + strings_not_displayed=[] ) + + def test_0020_create_repositories_from_0020_series( self ): + '''Create repositories emboss_0020 and emboss_datatypes_0020 if necessary.''' + category = self.create_category( name=category_0020_name, description='' ) repository = self.get_or_create_repository( name='emboss_datatypes_0020', description="Galaxy applicable data formats used by Emboss tools.", long_description="Galaxy applicable data formats used by Emboss tools. This repository contains no tools.", owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0010.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) if self.repository_is_new( repository ): self.upload_file( repository, @@ -127,7 +168,7 @@ description='Galaxy wrappers for Emboss version 5.0.0 tools', long_description='Galaxy wrappers for Emboss version 5.0.0 tools', owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0020.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) self.upload_file( repository, filename='emboss/emboss.tar', @@ -138,14 +179,17 @@ commit_message='Uploaded emboss.tar', strings_displayed=[], strings_not_displayed=[] ) + + def test_0025_create_repositories_from_0030_series( self ): + '''Create repositories emboss_0030, emboss_5_0030, emboss_6_0030, and emboss_datatypes_0030.''' + category = self.create_category( name=category_0030_name, description='' ) datatypes_repository = self.get_or_create_repository( name='emboss_datatypes_0030', description=datatypes_repository_description, long_description=datatypes_repository_long_description, owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0030.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) if self.repository_is_new( datatypes_repository ): - running_standalone = True self.upload_file( datatypes_repository, filename='emboss/datatypes/datatypes_conf.xml', filepath=None, @@ -160,7 +204,7 @@ description=emboss_repository_description, long_description=emboss_repository_long_description, owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0030.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) self.upload_file( emboss_5_repository, filename='emboss/emboss.tar', @@ -178,7 +222,7 @@ description=emboss_repository_description, long_description=emboss_repository_long_description, owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0030.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) self.upload_file( emboss_6_repository, filename='emboss/emboss.tar', @@ -196,7 +240,7 @@ description=emboss_repository_description, long_description=emboss_repository_long_description, owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0030.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) self.upload_file( emboss_repository, filename='emboss/emboss.tar', @@ -212,68 +256,82 @@ self.create_repository_dependency( repository=emboss_repository, repository_tuples=[ dependency_tuple ], filepath=repository_dependencies_path ) dependency_tuple = ( self.url, emboss_6_repository.name, emboss_6_repository.user.username, self.get_repository_tip( emboss_6_repository ) ) self.create_repository_dependency( repository=emboss_repository, repository_tuples=[ dependency_tuple ], filepath=repository_dependencies_path ) + + def test_0030_create_repositories_from_0040_series( self ): + '''Create repositories freebayes_0040 and filtering_0040.''' + category = self.create_category( name=category_0040_name, description='' ) repository = self.get_or_create_repository( name='freebayes_0040', description="Galaxy's freebayes tool", long_description="Long description of Galaxy's freebayes tool", owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0040.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) + + if self.repository_is_new( repository ): self.upload_file( repository, - filename='freebayes/freebayes.tar', + filename='freebayes/freebayes.tar', filepath=None, valid_tools_only=True, uncompress_file=True, - remove_repo_files_not_in_tar=False, - commit_message='Uploaded freebayes tarball.', + remove_repo_files_not_in_tar=False, + commit_message='Uploaded the tool tarball.', strings_displayed=[], strings_not_displayed=[] ) + repository = self.get_or_create_repository( name='filtering_0040', - description="Galaxy's filtering tool", - long_description="Long description of Galaxy's filtering tool", + description=filtering_repository_description, + long_description=filtering_repository_long_description, owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0040.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) self.upload_file( repository, - filename='filtering/filtering_1.1.0.tar', + filename='filtering/filtering_1.1.0.tar', filepath=None, valid_tools_only=True, uncompress_file=True, - remove_repo_files_not_in_tar=False, - commit_message='Uploaded filtering 1.1.0 tarball.', + remove_repo_files_not_in_tar=False, + commit_message='Uploaded the tool tarball for filtering 1.1.0.', strings_displayed=[], strings_not_displayed=[] ) + repository = self.test_db_util.get_repository_by_name_and_owner( 'freebayes_0040', common.test_user_1_name ) + filtering_repository = self.test_db_util.get_repository_by_name_and_owner( 'filtering_0040', common.test_user_1_name ) + repository_dependencies_path = self.generate_temp_path( 'test_1340', additional_paths=[ 'filtering' ] ) + repository_tuple = ( self.url, repository.name, repository.user.username, self.get_repository_tip( repository ) ) + self.create_repository_dependency( repository=filtering_repository, repository_tuples=[ repository_tuple ], filepath=repository_dependencies_path ) + repository = self.test_db_util.get_repository_by_name_and_owner( 'filtering_0040', common.test_user_1_name ) freebayes_repository = self.test_db_util.get_repository_by_name_and_owner( 'freebayes_0040', common.test_user_1_name ) - filtering_repository = self.test_db_util.get_repository_by_name_and_owner( 'filtering_0040', common.test_user_1_name ) - repository_dependencies_path = self.generate_temp_path( 'test_0340', additional_paths=[ 'dependencies' ] ) - dependency_tuple = ( self.url, freebayes_repository.name, freebayes_repository.user.username, self.get_repository_tip( freebayes_repository ) ) - self.create_repository_dependency( repository=filtering_repository, repository_tuples=[ dependency_tuple ], filepath=repository_dependencies_path ) - dependency_tuple = ( self.url, filtering_repository.name, filtering_repository.user.username, self.get_repository_tip( filtering_repository ) ) - self.create_repository_dependency( repository=freebayes_repository, repository_tuples=[ dependency_tuple ], filepath=repository_dependencies_path ) + repository_dependencies_path = self.generate_temp_path( 'test_1340', additional_paths=[ 'freebayes' ] ) + repository_tuple = ( self.url, repository.name, repository.user.username, self.get_repository_tip( repository ) ) + self.create_repository_dependency( repository=freebayes_repository, repository_tuples=[ repository_tuple ], filepath=repository_dependencies_path ) + + def test_0035_create_repositories_from_0050_series( self ): + '''Create repositories emboss_0050, emboss_datatypes_0050, filtering_0050, freebayes_0050.''' + category = self.create_category( name=category_0050_name, description='' ) datatypes_repository = self.get_or_create_repository( name='emboss_datatypes_0050', description="Datatypes for emboss", long_description="Long description of Emboss' datatypes", owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0050.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) if self.repository_is_new( datatypes_repository ): emboss_repository = self.get_or_create_repository( name='emboss_0050', description="Galaxy's emboss tool", long_description="Long description of Galaxy's emboss tool", owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0050.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) filtering_repository = self.get_or_create_repository( name='filtering_0050', description="Galaxy's filtering tool", long_description="Long description of Galaxy's filtering tool", owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0050.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) freebayes_repository = self.get_or_create_repository( name='freebayes_0050', description="Galaxy's freebayes tool", long_description="Long description of Galaxy's freebayes tool", owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0050.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) self.upload_file( datatypes_repository, filename='emboss/datatypes/datatypes_conf.xml', @@ -325,11 +383,14 @@ ( self.url, filtering_repository.name, filtering_repository.user.username, self.get_repository_tip( filtering_repository ) ), ( self.url, freebayes_repository.name, freebayes_repository.user.username, self.get_repository_tip( freebayes_repository ) ) ] self.create_repository_dependency( repository=freebayes_repository, repository_tuples=dependency_tuples, filepath=repository_dependencies_path ) + + def test_0035_create_repositories_from_0060_series( self ): + category = self.create_category( name=category_0060_name, description='' ) workflow_repository = self.get_or_create_repository( name='filtering_0060', description="Galaxy's filtering tool", long_description="Long description of Galaxy's filtering tool", owner=common.test_user_1_name, - category_id=self.security.encode_id( category_0060.id ), + category_id=self.security.encode_id( category.id ), strings_displayed=[] ) if self.repository_is_new( workflow_repository ): workflow = file( self.get_filename( 'filtering_workflow/Workflow_for_0060_filter_workflow_repository.ga' ), 'r' ).read() @@ -356,8 +417,8 @@ commit_message='Uploaded filtering 2.2.0 tarball.', strings_displayed=[], strings_not_displayed=[] ) - - def test_0010_install_all_missing_repositories( self ): + + def test_9900_install_all_missing_repositories( self ): '''Call the install_repository method to ensure that all required repositories are installed.''' global repository_datatypes_count global base_datatypes_count @@ -365,31 +426,24 @@ self.galaxy_logout() self.galaxy_login( email=common.admin_email, username=common.admin_username ) base_datatypes_count = int( self.get_datatypes_count() ) - category_0000 = 'Test 0000 Basic Repository Features 1' - category_0001 = 'Test 0000 Basic Repository Features 2' - category_0010 = 'Test 0010 Repository With Tool Dependencies' - category_0020 = 'Test 0020 Basic Repository Dependencies' - category_0030 = 'Test 0030 Repository Dependency Revisions' - category_0040 = 'test_0040_repository_circular_dependencies' - category_0050 = 'test_0050_repository_n_level_circular_dependencies' - category_0060 = 'Test 0060 Workflow Features' - self.install_repository( 'filtering_0000', common.test_user_1_name, category_0000, strings_displayed=[] ) - self.install_repository( 'freebayes_0010', common.test_user_1_name, category_0010, strings_displayed=[] ) - self.install_repository( 'emboss_0020', common.test_user_1_name, category_0020, strings_displayed=[] ) - self.install_repository( 'emboss_5_0030', common.test_user_1_name, category_0030, strings_displayed=[] ) - self.install_repository( 'filtering_0040', common.test_user_1_name, category_0040, strings_displayed=[] ) - self.install_repository( 'freebayes_0050', common.test_user_1_name, category_0050, strings_displayed=[] ) - self.install_repository( 'filtering_0060', common.test_user_1_name, category_0060, strings_displayed=[] ) + self.install_repository( 'filtering_0000', common.test_user_1_name, category_0000_name, strings_displayed=[] ) + self.install_repository( 'freebayes_0010', common.test_user_1_name, category_0010_name, strings_displayed=[] ) + self.install_repository( 'emboss_0020', common.test_user_1_name, category_0020_name, strings_displayed=[] ) + self.install_repository( 'emboss_5_0030', common.test_user_1_name, category_0030_name, strings_displayed=[] ) + self.install_repository( 'freebayes_0050', common.test_user_1_name, category_0050_name, strings_displayed=[] ) + self.install_repository( 'filtering_0060', common.test_user_1_name, category_0060_name, strings_displayed=[] ) current_datatypes = int( self.get_datatypes_count() ) # If we are running this test by itself, installing the emboss repository should also install the emboss_datatypes # repository, and this should add datatypes to the datatypes registry. If that is the case, verify that datatypes # have been added, otherwise verify that the count is unchanged. if running_standalone: - assert current_datatypes == base_datatypes_count + repository_datatypes_count, 'Installing emboss did not add new datatypes.' + message = 'Installing emboss did not add new datatypes.\nFound: %d\nExpected: %d' % \ + ( current_datatypes, base_datatypes_count + repository_datatypes_count ) + assert current_datatypes > base_datatypes_count, message else: assert current_datatypes == base_datatypes_count, 'Installing emboss added new datatypes.' - - def test_0015_reset_metadata_on_all_repositories( self ): + + def test_9905_reset_metadata_on_all_repositories( self ): '''Reset metadata on all repositories, then verify that it has not changed.''' repository_metadata = dict() repositories = self.test_db_util.get_all_installed_repositories( actually_installed=True )
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.
galaxy-commits@lists.galaxyproject.org