1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/211f30207d48/ Changeset: 211f30207d48 User: jmchilton Date: 2013-11-22 09:09:28 Summary: Extend tools API to allow use of data params with multiple='true' with multiple values. Likewise extend API driven tool testing framework to support these, add sample test cases. Also fixup english on a log warning. Affected #: 4 files diff -r 4ddfe2108c00f3ba6ff4eb097986297a2b5c98f2 -r 211f30207d48101a1250983d4f0f55c937f00a2e lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1739,7 +1739,13 @@ if isinstance( value, str ) and value.find( "," ) > 0: value = [ int( value_part ) for value_part in value.split( "," ) ] if isinstance( value, list ): - rval = [ trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( v ) for v in value ] + rval = [] + for single_value in value: + if isinstance( single_value, dict ): + assert single_value['src'] == 'hda' + rval.append( trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.app.security.decode_id( single_value[ 'id' ] ) ) ) + else: + rval.append( trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( single_value ) ) elif isinstance( value, trans.app.model.HistoryDatasetAssociation ): rval = value elif isinstance( value, dict ) and 'src' in value and 'id' in value: diff -r 4ddfe2108c00f3ba6ff4eb097986297a2b5c98f2 -r 211f30207d48101a1250983d4f0f55c937f00a2e lib/galaxy/tools/test.py --- a/lib/galaxy/tools/test.py +++ b/lib/galaxy/tools/test.py @@ -179,10 +179,12 @@ raw_input = context.extract_value( raw_inputs ) if raw_input: (name, param_value, param_extra) = raw_input + param_value = self.__split_if_str( param_value ) if isinstance( value, basic.DataToolParameter ): - processed_value = [ self.__add_uploaded_dataset( context.for_state(), param_value, param_extra, value ) ] + if not isinstance(param_value, list): + param_value = [ param_value ] + processed_value = [ self.__add_uploaded_dataset( context.for_state(), v, param_extra, value ) for v in param_value ] else: - param_value = self.__split_if_str( param_value ) processed_value = param_value expanded_inputs[ context.for_state() ] = processed_value return expanded_inputs @@ -309,7 +311,7 @@ for metadata_elem in output_elem.findall( 'metadata' ): metadata[ metadata_elem.get('name') ] = metadata_elem.get( 'value' ) if not (assert_list or file or extra_files or metadata): - raise Exception( "Test output defines not checks (e.g. must have a 'file' check against, assertions to check, etc...)") + raise Exception( "Test output defines nothting to check (e.g. must have a 'file' check against, assertions to check, etc...)") attributes['assert_list'] = assert_list attributes['extra_files'] = extra_files attributes['metadata'] = metadata diff -r 4ddfe2108c00f3ba6ff4eb097986297a2b5c98f2 -r 211f30207d48101a1250983d4f0f55c937f00a2e test/base/interactor.py --- a/test/base/interactor.py +++ b/test/base/interactor.py @@ -133,9 +133,13 @@ inputs_tree = testdef.inputs.copy() for key, value in inputs_tree.iteritems(): values = [value] if not isinstance(value, list) else value + new_values = [] for value in values: if value in self.uploads: - inputs_tree[ key ] = self.uploads[ value ] + new_values.append( self.uploads[ value ] ) + else: + new_values.append( value ) + inputs_tree[ key ] = new_values # # HACK: Flatten single-value lists. Required when using expand_grouping for key, value in inputs_tree.iteritems(): diff -r 4ddfe2108c00f3ba6ff4eb097986297a2b5c98f2 -r 211f30207d48101a1250983d4f0f55c937f00a2e test/functional/tools/multi_data_param.xml --- a/test/functional/tools/multi_data_param.xml +++ b/test/functional/tools/multi_data_param.xml @@ -18,13 +18,23 @@ <output name="out1" file="simple_line.txt" /><output name="out2" file="simple_line_alternative.txt" /></test> - <!-- TODO: Support this or something like this. + <test> + <param name="f1" value="simple_line.txt,simple_line_alternative.txt" /> + <param name="f2" value="simple_line_alternative.txt" /> + <output name="out1"> + <assert_contents> + <has_line line="This is a line of text." /> + <has_line line="This is a different line of text." /> + </assert_contents> + </output> + </test> + <!-- Twill interactor cannot do these latter two, but not even + UI widget can do this next one. --><test><param name="f1" value="simple_line.txt,simple_line.txt" /><param name="f2" value="simple_line_alternative.txt" /><output name="out1" file="simple_line_x2.txt" /> - <output name="out1" file="simple_line_alternative.txt" /> + <output name="out2" file="simple_line_alternative.txt" /></test> - --></tests></tool> 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.