[hg] galaxy 2974: Fix closure in creation of generated test meth...
details: http://www.bx.psu.edu/hg/galaxy/rev/12518f99a2a7 changeset: 2974:12518f99a2a7 user: James Taylor <james@jamestaylor.org> date: Fri Nov 06 00:25:02 2009 -0500 description: Fix closure in creation of generated test methods, otherwise the last testdef is used for every test diffstat: test/functional/test_toolbox.py | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diffs (19 lines): diff -r 071f12d75369 -r 12518f99a2a7 test/functional/test_toolbox.py --- a/test/functional/test_toolbox.py Thu Nov 05 17:55:14 2009 -0500 +++ b/test/functional/test_toolbox.py Fri Nov 06 00:25:02 2009 -0500 @@ -120,8 +120,11 @@ s = ( ToolTestCase, ) d = dict() for j, testdef in enumerate( tool.tests ): - def test_tool( self ): - self.do_it( testdef ) - test_tool.__doc__ = "%s ( %s ) > %s" % ( tool.name, tool.id, testdef.name ) - d['test_tool_%06d' % j] = test_tool + def make_test_method( td ): + def test_tool( self ): + self.do_it( td ) + return test_tool + m = make_test_method( testdef ) + m.__doc__ = "%s ( %s ) > %s" % ( tool.name, tool.id, testdef.name ) + d['test_tool_%06d' % j] = m G[ n ] = new.classobj( n, s, d )
participants (1)
-
Greg Von Kuster