1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/e0d69ca8be55/ Changeset: e0d69ca8be55 User: jmchilton Date: 2014-05-14 00:47:57 Summary: Fix duplicated names in on_text when using multiple data inputs. Unit tests verifing the fixed, correct behavior included. Bug introduced in e8c84dd715782e7c1d709d8068e6033b835f7f39 as an unintended consequence of duplicating the first dataset in the dictionary of input datasets generated by the tool action code. Fixes https://trello.com/c/LCEKxImR. Affected #: 2 files diff -r c1873e4d23fa2c496990e5bdef83300e929ae40c -r e0d69ca8be55cd8cfd863ad7f128e95a42eabfd3 lib/galaxy/tools/actions/__init__.py --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -472,6 +472,15 @@ def on_text_for_names( input_names ): + # input_names may contain duplicates... this is because the first value in + # multiple input dataset parameters will appear twice once as param_name + # and once as param_name1. + unique_names = [] + for name in input_names: + if name not in unique_names: + unique_names.append( name ) + input_names = unique_names + # Build name for output datasets based on tool name and input names if len( input_names ) == 1: on_text = input_names[0] diff -r c1873e4d23fa2c496990e5bdef83300e929ae40c -r e0d69ca8be55cd8cfd863ad7f128e95a42eabfd3 test/unit/tools/test_actions.py --- a/test/unit/tools/test_actions.py +++ b/test/unit/tools/test_actions.py @@ -2,6 +2,7 @@ from galaxy import model from galaxy.tools.actions import DefaultToolAction +from galaxy.tools.actions import on_text_for_names import tools_support @@ -25,6 +26,19 @@ ''' +def test_on_text_for_names(): + def assert_on_text_is( expected, *names ): + on_text = on_text_for_names( names ) + assert on_text == expected, "Wrong on text value %s, expected %s" % ( on_text, expected ) + + assert_on_text_is( "data 1", "data 1" ) + assert_on_text_is( "data 1 and data 2", "data 1", "data 2" ) + assert_on_text_is( "data 1, data 2, and data 3", "data 1", "data 2", "data 3" ) + assert_on_text_is( "data 1, data 2, and others", "data 1", "data 2", "data 3", "data 4" ) + + assert_on_text_is( "data 1 and data 2", "data 1", "data 1", "data 2" ) + + class DefaultToolActionTestCase( unittest.TestCase, tools_support.UsesApp, tools_support.UsesTools ): def setUp( self ): 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.