Mercurial > repos > fubar_too > planemo_test
changeset 1:36a2e28e7948 draft default tip
Uploaded
author | fubar_too |
---|---|
date | Fri, 21 May 2021 00:12:43 +0000 |
parents | ade62d8e0bad |
children | |
files | planemo_test/planemo_test.xml planemo_test/test-data/ToolFactory_toolshed_XML_from_the_history_to_test_sample planemo_test/test-data/Toolshed_archive_to_be_tested_sample planemo_test/test-data/new_tested_toolshed_archive_sample |
diffstat | 4 files changed, 126 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/planemo_test/planemo_test.xml Tue May 18 08:43:51 2021 +0000 +++ b/planemo_test/planemo_test.xml Fri May 21 00:12:43 2021 +0000 @@ -17,7 +17,8 @@ $new_tested_toolshed_archive]]></command> <configfiles> <configfile name="runme"><![CDATA[#raw -### script for ToolFactory toolshed archive test tool +# script for ToolFactory toolshed archive test tool +# most of the work is done in the rpyc server function exposed for this purpose import lxml.etree as ET @@ -26,8 +27,7 @@ import shutil import subprocess import sys -import tarfile -import time + def run_rsync(srcf, dstf): src = os.path.abspath(srcf) @@ -47,45 +47,26 @@ assert len(sys.argv) >= 3, 'Must have input xml and output archive paths on command line' xmlin = sys.argv[1] arcout = sys.argv[2] - conn = rpyc.connect("planemo-server", port=9999, config={'sync_request_timeout':1200}) tree = ET.parse(xmlin) root = tree.getroot() toolname = root.get('id') - os.mkdir('testout') # for collection + try: + conn = rpyc.connect("planemo-server", port=9999, config={'sync_request_timeout':1200}) + except ConnectionRefusedError: + print('### no remote rpyc server found on port 9999 - this only works in the ToolFactory Appliance with that server running...') + sys.exit(1) + collection = './testout' + abscoll = os.path.abspath(collection) + os.mkdir(collection) # for collection pwork = os.path.join("/export", "galaxy", "tested_TF_archives") ptooldir = os.path.join(pwork,toolname) pworkrep = os.path.join("/export", "galaxy", "tested_TF_reports") prepdir = os.path.join(pworkrep, toolname) galtooldir = os.path.join('/export/galaxy/tools/TFtools', toolname) - for maked in [prepdir, ptooldir]: - if not os.path.isdir(maked): - res = conn.root.run_cmd(f"mkdir -p {maked}") - res = conn.root.run_cmd(f"cp -r {galtooldir} {pwork}/") - toolxml = os.path.join(ptooldir, '%s.xml' % toolname) - res = conn.root.run_cmd("planemo lint %s" % toolxml) - if res: - with open(os.path.join('testout', '%s_planemo_lint_report.txt' % toolname), 'w') as lint: - lint.write(res) - lint.write('\nEnd report\n') - planemo_rep = os.path.join(prepdir, "%s_planemo_test_report.html" % toolname) - planemo_json = os.path.join(prepdir, "%s_planemo_test_report.json" % toolname) - planemo_log = os.path.join('testout', "%s_planemo_test_log.txt" % toolname) - res = conn.root.run_cmd("planemo --directory /planemo/work test --test_output_json %s --galaxy_root /galaxy-central \ - --conda_prefix /planemo/con --update_test_data --test_output %s %s" % (planemo_json, planemo_rep, toolxml)) - if not res: - res="no response...." - else: - with open(planemo_log, 'w') as replog: - replog.write(res) - res = conn.root.run_cmd(f"cp -r {ptooldir} /export/galaxy/tools/TFtools/") - shutil.copy(planemo_rep, 'testout') - run_rsync(prepdir, 'testout') - res = conn.root.run_cmd(f"tar -cvz -f {ptooldir}/{toolname}_tested.toolshed.gz --directory {pwork} {toolname}") + res = conn.root.planemo_lint_test(xmlin, abscoll) run_rsync(f"{ptooldir}/{toolname}_tested.toolshed.gz", ".") run_rsync(f"{ptooldir}/{toolname}_tested.toolshed.gz", galtooldir) shutil.copy(f"{toolname}_tested.toolshed.gz", arcout) - res = conn.root.run_cmd(f"chown -R galaxy:galaxy {pwork} {pworkrep} {galtooldir}") - main() #end raw]]></configfile> @@ -128,17 +109,16 @@ Script:: - ### script for ToolFactory toolshed archive test tool + # script for ToolFactory toolshed archive test tool + # most of the work is done in the rpyc server function exposed for this purpose import lxml.etree as ET import os + import sys import rpyc import shutil import subprocess - import sys - import tarfile - import time def run_rsync(srcf, dstf): src = os.path.abspath(srcf) @@ -158,45 +138,22 @@ assert len(sys.argv) >= 3, 'Must have input xml and output archive paths on command line' xmlin = sys.argv[1] arcout = sys.argv[2] - conn = rpyc.connect("planemo-server", port=9999, config={'sync_request_timeout':1200}) tree = ET.parse(xmlin) root = tree.getroot() toolname = root.get('id') - os.mkdir('testout') # for collection + conn = rpyc.connect("planemo-server", port=9999, config={'sync_request_timeout':1200}) + collection = './testout' + abscoll = os.path.abspath(collection) + os.mkdir(collection) # for collection pwork = os.path.join("/export", "galaxy", "tested_TF_archives") ptooldir = os.path.join(pwork,toolname) pworkrep = os.path.join("/export", "galaxy", "tested_TF_reports") prepdir = os.path.join(pworkrep, toolname) galtooldir = os.path.join('/export/galaxy/tools/TFtools', toolname) - for maked in [prepdir, ptooldir]: - if not os.path.isdir(maked): - res = conn.root.run_cmd(f"mkdir -p {maked}") # need a mkdir function - res = conn.root.run_cmd(f"cp -r {galtooldir} {pwork}/") - toolxml = os.path.join(ptooldir, '%s.xml' % toolname) - res = conn.root.run_cmd("planemo lint %s" % toolxml) # and a lint and test - if res: - with open(os.path.join('testout', '%s_planemo_lint_report.txt' % toolname), 'w') as lint: - lint.write(res) - lint.write('\nEnd report\n') - planemo_rep = os.path.join(prepdir, "%s_planemo_test_report.html" % toolname) - planemo_json = os.path.join(prepdir, "%s_planemo_test_report.json" % toolname) - planemo_log = os.path.join('testout', "%s_planemo_test_log.txt" % toolname) - res = conn.root.run_cmd("planemo --directory /planemo/work test --test_output_json %s --galaxy_root /galaxy-central \ - --conda_prefix /planemo/con --update_test_data --test_output %s %s" % (planemo_json, planemo_rep, toolxml)) - if not res: - res="no response...." - else: - with open(planemo_log, 'w') as replog: - replog.write(res) - res = conn.root.run_cmd(f"cp -r {ptooldir} /export/galaxy/tools/TFtools/") - shutil.copy(planemo_rep, 'testout') - run_rsync(prepdir, 'testout') - res = conn.root.run_cmd(f"tar -cvz -f {ptooldir}/{toolname}_tested.toolshed.gz --directory {pwork} {toolname}") + res = conn.root.planemo_lint_test(xmlin, abscoll) run_rsync(f"{ptooldir}/{toolname}_tested.toolshed.gz", ".") run_rsync(f"{ptooldir}/{toolname}_tested.toolshed.gz", galtooldir) shutil.copy(f"{toolname}_tested.toolshed.gz", arcout) - res = conn.root.run_cmd(f"chown -R galaxy:galaxy {pwork} {pworkrep} {galtooldir}") - main() ]]></help>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/planemo_test/test-data/ToolFactory_toolshed_XML_from_the_history_to_test_sample Fri May 21 00:12:43 2021 +0000 @@ -0,0 +1,53 @@ +<tool name="tacrev" id="tacrev" version="0.01"> + <!--Source in git at: https://github.com/fubar2/toolfactory--> + <!--Created by admin@galaxy.org at 15/05/2021 06:15:17 using the Galaxy Tool Factory.--> + <description></description> + <requirements/> + <stdio> + <exit_code range="1:" level="fatal"/> + </stdio> + <version_command><![CDATA[echo "0.01"]]></version_command> + <command><![CDATA[bash +$runme +< +$Input_text_file_to_be_reversed +> +$tacrev_reversed_output]]></command> + <configfiles> + <configfile name="runme"><![CDATA[#raw + +tac | rev + +#end raw]]></configfile> + </configfiles> + <inputs> + <param name="Input_text_file_to_be_reversed" type="data" optional="false" label="Input text file to be reversed" help="" format="txt" multiple="false"/> + </inputs> + <outputs> + <data name="tacrev_reversed_output" format="txt" hidden="false"/> + </outputs> + <tests> + <test> + <param name="Input_text_file_to_be_reversed" value="Input_text_file_to_be_reversed_sample"/> + <output name="tacrev_reversed_output" value="tacrev_reversed_output_sample"/> + </test> + </tests> + <help><![CDATA[ + +**What it Does** + + + +------ + + +Script:: + + tac | rev + +]]></help> + <citations> + <citation type="doi">10.1093/bioinformatics/bts573</citation> + </citations> +</tool> +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/planemo_test/test-data/new_tested_toolshed_archive_sample Fri May 21 00:12:43 2021 +0000 @@ -0,0 +1,53 @@ +<tool name="tacrev" id="tacrev" version="0.01"> + <!--Source in git at: https://github.com/fubar2/toolfactory--> + <!--Created by admin@galaxy.org at 15/05/2021 06:15:17 using the Galaxy Tool Factory.--> + <description></description> + <requirements/> + <stdio> + <exit_code range="1:" level="fatal"/> + </stdio> + <version_command><![CDATA[echo "0.01"]]></version_command> + <command><![CDATA[bash +$runme +< +$Input_text_file_to_be_reversed +> +$tacrev_reversed_output]]></command> + <configfiles> + <configfile name="runme"><![CDATA[#raw + +tac | rev + +#end raw]]></configfile> + </configfiles> + <inputs> + <param name="Input_text_file_to_be_reversed" type="data" optional="false" label="Input text file to be reversed" help="" format="txt" multiple="false"/> + </inputs> + <outputs> + <data name="tacrev_reversed_output" format="txt" hidden="false"/> + </outputs> + <tests> + <test> + <param name="Input_text_file_to_be_reversed" value="Input_text_file_to_be_reversed_sample"/> + <output name="tacrev_reversed_output" value="tacrev_reversed_output_sample"/> + </test> + </tests> + <help><![CDATA[ + +**What it Does** + + + +------ + + +Script:: + + tac | rev + +]]></help> + <citations> + <citation type="doi">10.1093/bioinformatics/bts573</citation> + </citations> +</tool> +