commit/galaxy-central: greg: A bit of code cleanup and enhanced logging for the tool shed's install and test framework.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/5378f0517318/ Changeset: 5378f0517318 User: greg Date: 2014-01-02 22:39:46 Summary: A bit of code cleanup and enhanced logging for the tool shed's install and test framework. Affected #: 3 files diff -r 1b0c9587a1da4adc4b75f843f10191e7136cf719 -r 5378f0517318861997ae7be112bbbf4098bdf7ce lib/galaxy/webapps/tool_shed/api/repository_revisions.py --- a/lib/galaxy/webapps/tool_shed/api/repository_revisions.py +++ b/lib/galaxy/webapps/tool_shed/api/repository_revisions.py @@ -209,6 +209,11 @@ repository_metadata.time_last_tested = datetime.datetime.utcnow() flush_needed = True elif hasattr( repository_metadata, key ): + # log information when setting attributes associated with the Tool Shed's install and test framework. + if key in [ 'do_not_test', 'includes_tools', 'missing_test_components', 'test_install_error', + 'tools_functionally_correct' ]: + log.debug( 'Setting repository_metadata table column %s to value %s for changeset_revision %s via the Tool Shed API.' % \ + ( str( key ), str( new_value ), str( repository_metadata.changeset_revision ) ) ) setattr( repository_metadata, key, new_value ) flush_needed = True if flush_needed: diff -r 1b0c9587a1da4adc4b75f843f10191e7136cf719 -r 5378f0517318861997ae7be112bbbf4098bdf7ce test/install_and_test_tool_shed_repositories/base/util.py --- a/test/install_and_test_tool_shed_repositories/base/util.py +++ b/test/install_and_test_tool_shed_repositories/base/util.py @@ -811,7 +811,7 @@ def register_test_result( url, tool_test_results_dicts, tool_test_results_dict, repository_dict, params, can_update_tool_shed ): """ - Update the repository metadata tool_test_results and appropriate flags using the Tool SHed API. This method + Update the repository metadata tool_test_results and appropriate flags using the Tool Shed API. This method updates tool_test_results with the relevant data, sets the do_not_test and tools_functionally correct flags to the appropriate values and updates the time_last_tested field to the value of the received time_tested. """ diff -r 1b0c9587a1da4adc4b75f843f10191e7136cf719 -r 5378f0517318861997ae7be112bbbf4098bdf7ce test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py --- a/test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py +++ b/test/install_and_test_tool_shed_repositories/repositories_with_tools/functional_tests.py @@ -52,14 +52,13 @@ from paste import httpserver from functional import database_contexts +import functional.test_toolbox as imported_test_toolbox log = logging.getLogger( 'install_and_test_repositories_with_tools' ) assert sys.version_info[ :2 ] >= ( 2, 6 ) test_home_directory = os.path.join( cwd, 'test', 'install_and_test_tool_shed_repositories', 'repositories_with_tools' ) -test_toolbox = None - # Here's the directory where everything happens. Temporary directories are created within this directory to contain # the database, new repositories, etc. galaxy_test_tmp_dir = os.path.join( test_home_directory, 'tmp' ) @@ -137,6 +136,8 @@ return tool_id, tool_version def install_and_test_repositories( app, galaxy_shed_tools_dict, galaxy_shed_tool_conf_file ): + global test_toolbox + test_toolbox = imported_test_toolbox # Initialize a dictionary for the summary that will be printed to stdout. install_and_test_statistics_dict = install_and_test_base_util.initialize_install_and_test_statistics_dict( test_framework ) error_message = '' @@ -441,9 +442,6 @@ app = UniverseApplication( **kwargs ) database_contexts.galaxy_context = app.model.context database_contexts.install_context = app.install_model.context - global test_toolbox - import functional.test_toolbox as imported_test_toolbox - test_toolbox = imported_test_toolbox log.debug( "Embedded Galaxy application started..." ) # ---- Run galaxy webserver ------------------------------------------------------ @@ -577,15 +575,12 @@ """ tests_to_delete = [] tools_to_delete_by_id = [] - # Push all the toolbox tests to module level G = globals() - # Eliminate all previous tests from G. for key, val in G.items(): if key.startswith( 'TestForTool_' ): del G[ key ] - global test_toolbox # Find all tests previously generated by twill. for key in test_toolbox.__dict__: if key.startswith( 'TestForTool_' ): @@ -609,17 +604,19 @@ def test_repository_tools( app, repository, repository_dict, tool_test_results_dicts, tool_test_results_dict, install_and_test_statistics_dict ): """Test tools contained in the received repository.""" + # Set the global variable 'test_toolbox', so that test.functional.test_toolbox will generate the + # appropriate test methods. + test_toolbox.toolbox = app.toolbox + # Get the attributes that identify the repository whose contained tools are being tested. name = str( repository.name ) owner = str( repository.owner ) changeset_revision = str( repository.changeset_revision ) repository_identifier_dict = dict( name=name, owner=owner, changeset_revision=changeset_revision ) - # Set the module-level variable 'toolbox', so that test.functional.test_toolbox will generate the - # appropriate test methods. At this point, app.toolbox contains the upload tool and all tools contained - # in the repository. - test_toolbox.toolbox = app.toolbox - # Generate the test methods for this installed repository. We need to pass in True here, or it will look - # in $GALAXY_HOME/test-data for test data, which may result in missing or invalid test files. - test_toolbox.build_tests( testing_shed_tools=True, master_api_key=install_and_test_base_util.default_galaxy_master_api_key ) + # Generate the test methods for this installed repository. We need to pass testing_shed_tools=True here + # or twill will look in $GALAXY_HOME/test-data for test data, which may result in missing or invalid test + # files. + test_toolbox.build_tests( testing_shed_tools=True, + master_api_key=install_and_test_base_util.default_galaxy_master_api_key ) # Set up nose to run the generated functional tests. test_config = nose.config.Config( env=os.environ, plugins=nose.plugins.manager.DefaultPluginManager() ) test_config.configure( sys.argv ) @@ -678,7 +675,8 @@ can_update_tool_shed ) log.debug( 'Revision %s of repository %s owned by %s installed successfully but did not pass functional tests.' % \ ( changeset_revision, name, owner ) ) - # Remove twills' old generated test before building the new tests for the current tools. + # Remove the just-executed tests so twill will not find and re-test them along with the tools + # contained in the next repository. remove_tests( app ) return install_and_test_statistics_dict Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org