From 5e13e15723301886c91bc30f73111be02a063434 Mon Sep 17 00:00:00 2001 From: Dave Bouvier Date: Mon, 6 May 2013 16:57:57 -0400 Subject: [PATCH] Fix mismatch between tool id and test id when deleting tests/uninstalling tested repositories. --- .../functional_tests.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/install_and_test_tool_shed_repositories/functional_tests.py b/test/install_and_test_tool_shed_repositories/functional_tests.py index d6a4d811529..8931b8101c6 100644 --- a/test/install_and_test_tool_shed_repositories/functional_tests.py +++ b/test/install_and_test_tool_shed_repositories/functional_tests.py @@ -196,6 +196,7 @@ def execute_uninstall_method( app ): name = str( repository.name ) owner = str( repository.owner ) changeset_revision = str( repository.installed_changeset_revision ) + log.debug( 'Changeset revision %s of repository %s queued for uninstallation.' % ( changeset_revision, name ) ) repository_dict = dict( name=name, owner=owner, changeset_revision=changeset_revision ) # Generate a test method to uninstall this repository through the embedded Galaxy application's web interface. test_install_repositories.generate_uninstall_method( repository_dict ) @@ -321,6 +322,7 @@ def remove_generated_tests( app ): # and try to re-run the tests after uninstalling the repository, which will cause false failure reports, # since the test data has been deleted from disk by now. tests_to_delete = [] + tools_to_delete = [] global test_toolbox for key in test_toolbox.__dict__: if key.startswith( 'TestForTool_' ): @@ -328,12 +330,14 @@ def remove_generated_tests( app ): # We can't delete this test just yet, we're still iterating over __dict__. tests_to_delete.append( key ) tool_id = key.replace( 'TestForTool_', '' ) - if tool_id in app.toolbox.tools_by_id: - # But we can remove the relevant tool from app.toolbox.tools_by_id. - del app.toolbox.tools_by_id[ tool_id ] + for tool in app.toolbox.tools_by_id: + if tool.replace( '_', ' ' ) == tool_id.replace( '_', ' ' ): + tools_to_delete.append( tool ) for key in tests_to_delete: # Now delete the tests found in the previous loop. del test_toolbox.__dict__[ key ] + for tool in tools_to_delete: + del app.toolbox.tools_by_id[ tool ] def run_tests( test_config ): loader = nose.loader.TestLoader( config=test_config )