1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/7b889da9b563/ Changeset: 7b889da9b563 User: inithello Date: 2014-01-16 17:30:25 Summary: Fix deletion of test methods after tests have been run. Affected #: 3 files diff -r 659a29d112f622db5dabb65e4105535b5aee3b30 -r 7b889da9b563bc8245977dceb5aa4b8965857aa2 scripts/functional_tests.py --- a/scripts/functional_tests.py +++ b/scripts/functional_tests.py @@ -498,6 +498,7 @@ functional.test_toolbox.toolbox = app.toolbox # When testing data managers, do not test toolbox. functional.test_toolbox.build_tests( + app=app, testing_shed_tools=testing_shed_tools, master_api_key=master_api_key, user_api_key=get_user_api_key(), diff -r 659a29d112f622db5dabb65e4105535b5aee3b30 -r 7b889da9b563bc8245977dceb5aa4b8965857aa2 test/functional/test_toolbox.py --- a/test/functional/test_toolbox.py +++ b/test/functional/test_toolbox.py @@ -72,13 +72,13 @@ raise -def build_tests( testing_shed_tools=False, master_api_key=None, user_api_key=None ): +def build_tests( app=None, testing_shed_tools=False, master_api_key=None, user_api_key=None ): """ If the module level variable `toolbox` is set, generate `ToolTestCase` classes for all of its tests and put them into this modules globals() so they can be discovered by nose. """ - if toolbox is None: + if app is None: return # Push all the toolbox tests to module level @@ -88,9 +88,8 @@ for key, val in G.items(): if key.startswith( 'TestForTool_' ): del G[ key ] - - for i, tool_id in enumerate( toolbox.tools_by_id ): - tool = toolbox.get_tool( tool_id ) + for i, tool_id in enumerate( app.toolbox.tools_by_id ): + tool = app.toolbox.get_tool( tool_id ) if isinstance( tool, TOOL_TYPES_NO_TEST ): #We do not test certain types of tools (e.g. Data Manager tools) as part of ToolTestCase continue diff -r 659a29d112f622db5dabb65e4105535b5aee3b30 -r 7b889da9b563bc8245977dceb5aa4b8965857aa2 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 @@ -595,21 +595,16 @@ """ 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 ] - # Find all tests previously generated by twill. for key in test_toolbox.__dict__: if key.startswith( 'TestForTool_' ): - log.debug( 'Tool test %s discovered in test_toolbox.' % str( key ) ) # We can't delete this test just yet, we're still iterating over __dict__. tests_to_delete.append( key ) tool_id = key.replace( 'TestForTool_', '' ) for app_tool_id in app.toolbox.tools_by_id: - if app_tool_id.replace( '_', ' ' ) == tool_id.replace( '_', ' ' ): + # Revisit this code if at some point we notice that Twill re-runs tests that should have been deleted. + # Undoubtedly the following if statement will need to be enhanced to find the tool id in question. For + # example, the following or is required because Twill replaces some spaces with underscores in test names. + if app_tool_id == tool_id or app_tool_id.replace( '_', ' ' ) == tool_id.replace( '_', ' ' ): tools_to_delete_by_id.append( tool_id ) # Delete the discovered twill-generated tests. for key in tests_to_delete: @@ -617,16 +612,12 @@ log.debug( 'Deleting test %s from test_toolbox.' % str( key ) ) del test_toolbox.__dict__[ key ] for tool_id in tools_to_delete_by_id: - if tool_id in app.toolbox.tools_by_id: - log.debug( 'Deleting tool id %s from app.toolbox[ tools_by_id ].' % str( tool_id ) ) - del app.toolbox.tools_by_id[ tool_id ] + log.debug( 'Deleting tool id %s from app.toolbox[ tools_by_id ].' % str( tool_id ) ) + del app.toolbox.tools_by_id[ tool_id ] 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 ) @@ -635,7 +626,8 @@ # 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, + test_toolbox.build_tests( app=app, + 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() ) 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.