On Mon, Apr 15, 2013 at 2:15 PM, Dave Bouvier <d...@bx.psu.edu> wrote:
> Peter,
>
> Thanks for reporting this issue, it looks like there might be a bug in
> tool_list.py, which I will be looking into. In the meantime, you should
> still be able to run functional tests for your tool by executing
>
> sh run_functional_tests.sh -id <tool_id>
>
> Where <tool_id> is the ID you have defined in the tool XML. The
> functional_tests.py script uses Galaxy's internal tool XML parser to
> generate the list of functional tests to run, so it should be able to find
> your tool and its tests.
>
>    --Dave B.

Thanks for the clue Dave - you're right it is a bug in tool_list.py
which uses its own quick and dirty XML parser. The bug was
that is was confused by the use of the magic words 'id', 'name'
or 'description' in the values.

The patch below works for me, but assumes that there will
not be a space between the key and the equals sign. The
script remains a fragile hack - for instance if a tool's XML file
split the <tool> tag over multiple lines, only the first line
is used. Using a real XML parser instead would be better.

The patch also addresses a potential overflow bug where it
tests n = len(keys) - 1 as a possible key, and would then
go out of bounds to get the value from list element n+1.

The patch also replaces the use of -1 from find, using "in" is
far clearer.

The patch does not fix the non-standard 3 space indentation
(PEP8 recommends 4 space indentation).

Could you test this and commit it?

Peter

P.S. Yes, you're right for tool identifiers the ID is easy to get from
the tool's XML file (that doesn't work for sections though).

-- 

diff -r d8d3e4fe7c45 tool_list.py
--- a/tool_list.py      Fri Apr 12 11:27:17 2013 +0100
+++ b/tool_list.py      Mon Apr 15 14:51:34 2013 +0100
@@ -35,14 +35,15 @@
       for line in open("tools/"+tool) :
          if line.find("<tool ") != -1 and line.find("id") != -1 :
             keys = line.strip().split('\"')
-            n = 0
             tool_info = dict()
             tool_info["desc"] = ''
-            while n < len(keys) :
-               if keys[n].find("id") != -1 : tool_info["id"] =
keys[n+1].replace(' ', '_')
-               if keys[n].find("name") != -1 : tool_info["name"] = keys[n+1]
-               if keys[n].find("description") != -1 :
tool_info["desc"] = keys[n+1]
-               n = n + 1
+            for n in range(len(keys)-1):
+               if " id=" in keys[n]:
+                  tool_info["id"] = keys[n+1].replace(' ', '_')
+               if " name=" in keys[n]:
+                  tool_info["name"] = keys[n+1]
+               if " description=" in keys[n]:
+                  tool_info["desc"] = keys[n+1]
             tool_infos.append(tool_info)
             break
___________________________________________________________
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/

Reply via email to