Question: Running tests for my tools.xml
0
gravatar for plindenbaum
2.1 years ago by
plindenbaum90
France
plindenbaum90 wrote:

It's not clear to me how I can run the <tests/> for the tools.xml I've created. My tools require an environment variable set in galaxy's:

config/local_env.sh

Running planemo test (takes a long time to start ('migrating...' ) ...) and fails because the $variable is not available.

How can I run the tests when I install the tools via the toolshed ? Are the tests activated when I install the tools ? I cannot find a page describing this operation.

Thanks.

tests • 682 views
ADD COMMENTlink modified 2.1 years ago by y.hoogstrate460 • written 2.1 years ago by plindenbaum90
2
gravatar for y.hoogstrate
2.1 years ago by
y.hoogstrate460
Netherlands
y.hoogstrate460 wrote:

Hi plindenbaum,

I am not entirely sure if I understand what you're asking but I'll give it a shot.

First of all planemo is indeed the tool used for testing. Let's say we have the following tool:

<tool id="test" name="test" version="1.0.0">
    <command><![CDATA[
        echo "\$HELLO_WORLD" > '$out' ;
    ]]></command>
    <inputs>
    </inputs>
    <outputs>
        <data format="txt" name="out" />
    </outputs>
    <tests>
        <test>
            <output name="out" file="out.txt"/>
        </test>
    </tests>
</tool>

We can load the env-var into a galaxy tool by simply running: export HELLO_WORLD='....'; planemo test tool.xml. First planemo is checking the database version of the galaxy instance. If you have not specified a custom galaxy instance, it will use the one that has been installed with planemo which is usually fairly up to date and should not migrate too much. I've also had situations where I get a migration list starting from the beginning once in a while, probably my galaxy version was not configured properly, way out of date or newer than the one shipped with planemo. I don't know the precise scenarios when this is happening, but it is actually incrementally upgrading the galaxy database. If everything goes well it starts at version 120+ or so.

Planemo shall start galaxy and do some magic to simulate a real galaxy environment. Galaxy is running its jobs as child processes, so environment variables shall be passed through. I don't know what you mean with using config/local_envs.sh. If you would like to configure server-wide environment variables that should automatically be loaded during startup of Galaxy, you can configure this in {$galaxy_root}/config/job_conf.xml.

If you would use the following:

<?xml version="1.0"?>
<!-- A sample job config that explicitly configures job running the way it is configured by default (if there is no explicit config). -->
<job_conf>
    <plugins>
        <plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="4"/>
    </plugins>
    <handlers>
        <handler id="main"/>
    </handlers>
    <destinations>
        <destination id="local" runner="local">
            <env id="HELLO_WORLD_VIA_LOCAL_ENV">via-job-conf.xml</env>
        </destination>
    </destinations>
</job_conf>

Galaxy shall do the following for you: export HELLO_WORLD_VIA_LOCAL_ENV='via-job-conf.xml'. You only need to make sure planemo shall use this configuration file. You can do this by configuring a proper galaxy instance in ~/.planemo.yml and updating the job_conf in the corresponding $galaxy_root/config directory, or run planemo test --job_config_file ....job_conf.xml. I tested this with the following tool:

<tool id="test" name="test" version="1.0.0">
    <command><![CDATA[
        echo "\$HELLO_WORLD" > '$out' ;
        echo "\$HELLO_WORLD_VIA_LOCAL_ENV" >> '$out' ;
    ]]></command>
    <inputs>
    </inputs>
    <outputs>
        <data format="txt" name="out" />
    </outputs>
    <tests>
        <test>
            <output name="out" file="out.txt"/>
        </test>
    </tests>
</tool>

And I was able to show both environment variables running planemo test --job_config_file ....job_conf.xml test.xml

Let's see if this gets you started. All best,

Youri

ADD COMMENTlink written 2.1 years ago by y.hoogstrate460

thank you Youri for this long answer ! I'll try this tomorrow morning !

ADD REPLYlink written 2.1 years ago by plindenbaum90
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 173 users visited in the last hour