Problem writing functional tool tests with 'repeat' & 'conditional' tags

classic Classic list List threaded Threaded
3 messages Options
| Threaded
Open this post in threaded view
|

Problem writing functional tool tests with 'repeat' & 'conditional' tags

Peter Briggs
Hello all

I'm experiencing problems with specifying some tests for a Galaxy tool
I've written, which are related to setting the value of a 'conditional'
parameter that is defined within a 'repeat' tag.

The bones of the tool XML look like:

     ...
     <repeat name="operations" title="..." min="1">
       <conditional name="operation">
        <param name="name" type="select" label="...">
          <option selected="true" value="SLIDINGWINDOW">Sliding window
trimming...</option>
           <!--further options snipped-->
        </param>
        <when value="SLIDINGWINDOW">
        ...

When I run the functional tests I get:

base.twilltestcase: ERROR: In submit_form, continuing, but caught exception.
Traceback (most recent call last):
   File "XXXXX/galaxy-dist/test/base/twilltestcase.py", line 1910, in
submit_form
     for value in kwd[ control.name ]:
KeyError: 'operations_0|operation|name'

Is there a way to specify the the value in the tests? I've tried both

        <param name="operations_0.operation.name' value="..." />
and
        <param name="operations_0|operation|name' value="..." />

in my <test>s, but neither form seem to change the exception from the tests.

Any suggestions are greatly appreciated!

Peter

--
Peter Briggs [hidden email]
Bioinformatics Core Facility University of Manchester
B.1083 Michael Smith Bldg Tel: (0161) 2751482
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
| Threaded
Open this post in threaded view
|

Re: Problem writing functional tool tests with 'repeat' & 'conditional' tags

John Chilton-4
Hello Peter,

  For both of your questions it would be very helpful to know what
version of Galaxy you are using (which tagged version or output of hg
id -i).

  I noticed you have min on your repeat - this did not work for the
older Twill test runner historically (and may still not) but it isn't
a problem for the newer API test framework. This next release will
switch the default test framework to the newer API one but this is not
the default for any past tagged releases - unless your Galaxy is
really old you should be able to execute "export
GALAXY_TEST_DEFAULT_INTERACTOR=api"  in the shell before running tests
to get the newer behavior. This fixes a lot of problems.

  The older runner will also not accept the syntax <param
name="operations_0|operation|name' value="..." /> but the newer runner
should no problem.

  Hope this gives you some ideas on how to proceed.

-John

On Wed, Sep 17, 2014 at 5:37 AM, Peter Briggs
<[hidden email]> wrote:

> Hello all
>
> I'm experiencing problems with specifying some tests for a Galaxy tool I've
> written, which are related to setting the value of a 'conditional' parameter
> that is defined within a 'repeat' tag.
>
> The bones of the tool XML look like:
>
>     ...
>     <repeat name="operations" title="..." min="1">
>       <conditional name="operation">
>         <param name="name" type="select" label="...">
>           <option selected="true" value="SLIDINGWINDOW">Sliding window
> trimming...</option>
>           <!--further options snipped-->
>         </param>
>         <when value="SLIDINGWINDOW">
>         ...
>
> When I run the functional tests I get:
>
> base.twilltestcase: ERROR: In submit_form, continuing, but caught exception.
> Traceback (most recent call last):
>   File "XXXXX/galaxy-dist/test/base/twilltestcase.py", line 1910, in
> submit_form
>     for value in kwd[ control.name ]:
> KeyError: 'operations_0|operation|name'
>
> Is there a way to specify the the value in the tests? I've tried both
>
>         <param name="operations_0.operation.name' value="..." />
> and
>         <param name="operations_0|operation|name' value="..." />
>
> in my <test>s, but neither form seem to change the exception from the tests.
>
> Any suggestions are greatly appreciated!
>
> Peter
>
> --
> Peter Briggs [hidden email]
> Bioinformatics Core Facility University of Manchester
> B.1083 Michael Smith Bldg Tel: (0161) 2751482
> ___________________________________________________________
> Please keep all replies on the list by using "reply all"
> in your mail client.  To manage your subscriptions to this
> and other Galaxy lists, please use the interface at:
>  http://lists.bx.psu.edu/
>
> To search Galaxy mailing lists use the unified search at:
>  http://galaxyproject.org/search/mailinglists/
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
| Threaded
Open this post in threaded view
|

Re: Problem writing functional tool tests with 'repeat' & 'conditional' tags

Peter Briggs
Hello John

Thanks for your reply and suggestions, they have been extremely helpful.

Doing "hg id -i" gives db520d154716, and having fudged the environment
to work around the issue of missing dependencies, the tests are now
succeeding using the

        <param name="operations_0|operation|name" ... />

form that you suggested. It doesn't look as if the "min" attribute is
causing any trouble in these cases.

(In the interests of full disclosure, I think my previous problem might
also have been compounded by not specifying the "ftype" attribute when
specifying input files elsewhere.)

Thanks also for the tip off about using the API test framework, I just
gave it a try and it looks a bit cleaner than the Twill version. I will
switch to using that from now on.

Thanks so much for your help,

Best wishes

Peter

On 17/09/14 14:00, John Chilton wrote:

> Hello Peter,
>
>    For both of your questions it would be very helpful to know what
> version of Galaxy you are using (which tagged version or output of hg
> id -i).
>
>    I noticed you have min on your repeat - this did not work for the
> older Twill test runner historically (and may still not) but it isn't
> a problem for the newer API test framework. This next release will
> switch the default test framework to the newer API one but this is not
> the default for any past tagged releases - unless your Galaxy is
> really old you should be able to execute "export
> GALAXY_TEST_DEFAULT_INTERACTOR=api"  in the shell before running tests
> to get the newer behavior. This fixes a lot of problems.
>
>    The older runner will also not accept the syntax <param
> name="operations_0|operation|name' value="..." /> but the newer runner
> should no problem.
>
>    Hope this gives you some ideas on how to proceed.
>
> -John
>
> On Wed, Sep 17, 2014 at 5:37 AM, Peter Briggs
> <[hidden email]> wrote:
>> Hello all
>>
>> I'm experiencing problems with specifying some tests for a Galaxy tool I've
>> written, which are related to setting the value of a 'conditional' parameter
>> that is defined within a 'repeat' tag.
>>
>> The bones of the tool XML look like:
>>
>>      ...
>>      <repeat name="operations" title="..." min="1">
>>        <conditional name="operation">
>>          <param name="name" type="select" label="...">
>>            <option selected="true" value="SLIDINGWINDOW">Sliding window
>> trimming...</option>
>>            <!--further options snipped-->
>>          </param>
>>          <when value="SLIDINGWINDOW">
>>          ...
>>
>> When I run the functional tests I get:
>>
>> base.twilltestcase: ERROR: In submit_form, continuing, but caught exception.
>> Traceback (most recent call last):
>>    File "XXXXX/galaxy-dist/test/base/twilltestcase.py", line 1910, in
>> submit_form
>>      for value in kwd[ control.name ]:
>> KeyError: 'operations_0|operation|name'
>>
>> Is there a way to specify the the value in the tests? I've tried both
>>
>>          <param name="operations_0.operation.name' value="..." />
>> and
>>          <param name="operations_0|operation|name' value="..." />
>>
>> in my <test>s, but neither form seem to change the exception from the tests.
>>
>> Any suggestions are greatly appreciated!
>>
>> Peter
>>
>> --
>> Peter Briggs [hidden email]
>> Bioinformatics Core Facility University of Manchester
>> B.1083 Michael Smith Bldg Tel: (0161) 2751482
>> ___________________________________________________________
>> Please keep all replies on the list by using "reply all"
>> in your mail client.  To manage your subscriptions to this
>> and other Galaxy lists, please use the interface at:
>>   http://lists.bx.psu.edu/
>>
>> To search Galaxy mailing lists use the unified search at:
>>   http://galaxyproject.org/search/mailinglists/

--
Peter Briggs [hidden email]
Bioinformatics Core Facility University of Manchester
B.1083 Michael Smith Bldg Tel: (0161) 2751482
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/