galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
July 2013
- 1 participants
- 83 discussions
commit/galaxy-central: jgoecks: Allow spaces and commas in Cuffdiff labels.
by commits-noreply@bitbucket.org 01 Jul '13
by commits-noreply@bitbucket.org 01 Jul '13
01 Jul '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5b27b92310d0/
Changeset: 5b27b92310d0
User: jgoecks
Date: 2013-07-01 15:46:09
Summary: Allow spaces and commas in Cuffdiff labels.
Affected #: 1 file
diff -r 5a73d78e0a4782d9c57d8c1d6cea167e4f4671b6 -r 5b27b92310d044cfd2f9b3711e5ef446048de110 tools/ngs_rna/cuffdiff_wrapper.xml
--- a/tools/ngs_rna/cuffdiff_wrapper.xml
+++ b/tools/ngs_rna/cuffdiff_wrapper.xml
@@ -59,7 +59,9 @@
## Replicates.
--labels
#for $group in $group_analysis.groups
- "${group.group}"
+ ## Cuffdiff uses commas as delimiters, so replace them with underscores to avoid
+ ## parsing problems.
+ "${group.group.replace(',', '_')}"
#end for
--files
#for $group in $group_analysis.groups
@@ -80,7 +82,7 @@
</param><when value="Yes"><repeat name="groups" title="Group">
- <param name="group" title="Group name" type="text" label="Group name (no spaces or commas)"/>
+ <param name="group" title="Group name" type="text" label="Group name"/><repeat name="files" title="Replicate"><param name="file" label="Add file" type="data" format="sam,bam"/></repeat>
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.
1
0
commit/galaxy-central: dannon: Fix converter imports -- resolves failing unit tests
by commits-noreply@bitbucket.org 01 Jul '13
by commits-noreply@bitbucket.org 01 Jul '13
01 Jul '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5a73d78e0a47/
Changeset: 5a73d78e0a47
User: dannon
Date: 2013-07-01 11:57:51
Summary: Fix converter imports -- resolves failing unit tests
Affected #: 2 files
diff -r 6673bd3bf4571c4134797077ca85350a6319e444 -r 5a73d78e0a4782d9c57d8c1d6cea167e4f4671b6 lib/galaxy/datatypes/converters/interval_to_interval_index_converter.py
--- a/lib/galaxy/datatypes/converters/interval_to_interval_index_converter.py
+++ b/lib/galaxy/datatypes/converters/interval_to_interval_index_converter.py
@@ -11,15 +11,13 @@
from __future__ import division
-import sys, fileinput, optparse
+import optparse
from galaxy import eggs
-import pkg_resources; pkg_resources.require( "bx-python" )
-from galaxy.visualization.tracks.summary import *
-from galaxy.datatypes.util.gff_util import convert_gff_coords_to_bed
+eggs.require( "bx-python" )
from bx.interval_index_file import Indexes
def main():
-
+
# Read options, args.
parser = optparse.OptionParser()
parser.add_option( '-c', '--chr-col', type='int', dest='chrom_col', default=1 )
@@ -27,12 +25,12 @@
parser.add_option( '-e', '--end-col', type='int', dest='end_col', default=3 )
(options, args) = parser.parse_args()
input_fname, output_fname = args
-
+
# Make column indices 0-based.
options.chrom_col -= 1
options.start_col -= 1
options.end_col -= 1
-
+
# Do conversion.
index = Indexes()
offset = 0
@@ -46,9 +44,9 @@
chrom_end = int( feature[ options.end_col ] )
index.add( chrom, chrom_start, chrom_end, offset )
offset += len(line)
-
+
index.write( open(output_fname, "w") )
-if __name__ == "__main__":
+if __name__ == "__main__":
main()
-
\ No newline at end of file
+
diff -r 6673bd3bf4571c4134797077ca85350a6319e444 -r 5a73d78e0a4782d9c57d8c1d6cea167e4f4671b6 lib/galaxy/datatypes/converters/pileup_to_interval_index_converter.py
--- a/lib/galaxy/datatypes/converters/pileup_to_interval_index_converter.py
+++ b/lib/galaxy/datatypes/converters/pileup_to_interval_index_converter.py
@@ -8,20 +8,18 @@
from __future__ import division
-import sys, fileinput, optparse
+import optparse
from galaxy import eggs
-import pkg_resources; pkg_resources.require( "bx-python" )
-from galaxy.visualization.tracks.summary import *
-from galaxy.datatypes.util.gff_util import convert_gff_coords_to_bed
+eggs.require( "bx-python" )
from bx.interval_index_file import Indexes
def main():
-
+
# Read options, args.
parser = optparse.OptionParser()
(options, args) = parser.parse_args()
input_fname, output_fname = args
-
+
# Do conversion.
index = Indexes()
offset = 0
@@ -31,9 +29,9 @@
start = int( start ) - 1
index.add( chrom, start, start + 1, offset )
offset += len( line )
-
+
index.write( open(output_fname, "w") )
-if __name__ == "__main__":
+if __name__ == "__main__":
main()
-
\ No newline at end of file
+
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.
1
0
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/682bc706f5d6/
Changeset: 682bc706f5d6
User: jmchilton
Date: 2013-06-24 16:28:14
Summary: Create unit test directory with example test. Enable coverage report generation of unit tests (run_unit_tests.sh will automatically add --with-coverage to nosetests call if coverage is on the path, coverage report can than be generated with 'coverage html' and viewed at htmlcov/index.html). Update .hgignore to reflect these changes.
Affected #: 6 files
diff -r dc6e0347edffb96fe4e633b362ad21a9f5a83e81 -r 682bc706f5d6c8caab7a46e405cdee158268c373 .coveragerc
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,3 @@
+[run]
+branch = True
+include = lib/galaxy/*
diff -r dc6e0347edffb96fe4e633b362ad21a9f5a83e81 -r 682bc706f5d6c8caab7a46e405cdee158268c373 .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -82,6 +82,9 @@
# Test output
run_functional_tests.html
test/tool_shed/tmp/*
+.coverage
+htmlcov
+run_unit_tests.html
# Project files
*.kpf
diff -r dc6e0347edffb96fe4e633b362ad21a9f5a83e81 -r 682bc706f5d6c8caab7a46e405cdee158268c373 lib/galaxy/tools/loader.py
--- a/lib/galaxy/tools/loader.py
+++ b/lib/galaxy/tools/loader.py
@@ -202,199 +202,3 @@
current_index += 1
parent_el.insert(current_index, deepcopy(target))
parent_el.remove(query)
-
-
-def test_loader():
- """
- Function to test this module. Galaxy doesn't seem to have a
- place to put unit tests that are not doctests. These tests can
- be run with nosetests via the following command:
-
- % nosetests lib/galaxy/tools/loader.py
-
- """
- from tempfile import mkdtemp
- from shutil import rmtree
-
- class TestToolDirectory(object):
- def __init__(self):
- self.temp_directory = mkdtemp()
-
- def __enter__(self):
- return self
-
- def __exit__(self, type, value, tb):
- rmtree(self.temp_directory)
-
- def write(self, contents, name="tool.xml"):
- open(os.path.join(self.temp_directory, name), "w").write(contents)
-
- def load(self, name="tool.xml", preprocess=True):
- if preprocess:
- loader = load_tool
- else:
- loader = parse_xml
- return loader(os.path.join(self.temp_directory, name))
-
- ## Test simple macro replacement.
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs" />
- <macros>
- <macro name="inputs">
- <inputs />
- </macro>
- </macros>
-</tool>''')
- xml = tool_dir.load(preprocess=False)
- assert xml.find("inputs") is None
- xml = tool_dir.load(preprocess=True)
- assert xml.find("inputs") is not None
-
- # Test importing macros from external files
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs" />
- <macros>
- <import>external.xml</import>
- </macros>
-</tool>''')
-
- tool_dir.write('''
-<macros>
- <macro name="inputs">
- <inputs />
- </macro>
-</macros>''', name="external.xml")
- xml = tool_dir.load(preprocess=False)
- assert xml.find("inputs") is None
- xml = tool_dir.load(preprocess=True)
- assert xml.find("inputs") is not None
-
- # Test macros with unnamed yield statements.
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs">
- <input name="first_input" />
- </expand>
- <macros>
- <macro name="inputs">
- <inputs>
- <yield />
- </inputs>
- </macro>
- </macros>
-</tool>''')
- xml = tool_dir.load()
- assert xml.find("inputs").find("input").get("name") == "first_input"
-
- # Test recursive macro applications.
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs">
- <input name="first_input" />
- <expand macro="second" />
- </expand>
- <macros>
- <macro name="inputs">
- <inputs>
- <yield />
- </inputs>
- </macro>
- <macro name="second">
- <input name="second_input" />
- </macro>
- </macros>
-</tool>''')
- xml = tool_dir.load()
- assert xml.find("inputs").findall("input")[1].get("name") == "second_input"
-
- # Test recursive macro applications.
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs">
- <input name="first_input" />
- <expand macro="second" />
- </expand>
- <macros>
- <macro name="inputs">
- <inputs>
- <yield />
- </inputs>
- </macro>
- <macro name="second">
- <expand macro="second_delegate" />
- </macro>
- <macro name="second_delegate">
- <input name="second_input" />
- </macro>
- </macros>
-</tool>''')
- xml = tool_dir.load()
- assert xml.find("inputs").findall("input")[1].get("name") == "second_input"
-
- # Test <xml> is shortcut for macro type="xml"
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs" />
- <macros>
- <xml name="inputs">
- <inputs />
- </xml>
- </macros>
-</tool>''')
- xml = tool_dir.load()
- assert xml.find("inputs") is not None
-
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <command interpreter="python">tool_wrapper.py
- #include source=$tool_params
- </command>
- <macros>
- <template name="tool_params">-a 1 -b 2</template>
- </macros>
-</tool>
-''')
- xml = tool_dir.load()
- params_dict = template_macro_params(xml.getroot())
- assert params_dict['tool_params'] == "-a 1 -b 2"
-
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <macros>
- <token name="@CITATION@">The citation.</token>
- </macros>
- <help>@CITATION@</help>
- <another>
- <tag />
- </another>
-</tool>
-''')
- xml = tool_dir.load()
- help_el = xml.find("help")
- assert help_el.text == "The citation.", help_el.text
-
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <macros>
- <token name="@TAG_VAL@">The value.</token>
- </macros>
- <another>
- <tag value="@TAG_VAL@" />
- </another>
-</tool>
-''')
- xml = tool_dir.load()
- tag_el = xml.find("another").find("tag")
- value = tag_el.get('value')
- assert value == "The value.", value
diff -r dc6e0347edffb96fe4e633b362ad21a9f5a83e81 -r 682bc706f5d6c8caab7a46e405cdee158268c373 run_unit_tests.sh
--- a/run_unit_tests.sh
+++ b/run_unit_tests.sh
@@ -3,7 +3,14 @@
## Excluding controllers due to the problematic genetrack dependency
## Excluding job runners due to various external dependencies
-python ./scripts/nosetests.py -v -w lib \
+COVERAGE=`which coverage`
+COVERAGE_ARG=""
+if [ $COVERAGE ]; then
+ COVERAGE_ARG="--with-coverage"
+fi
+
+python ./scripts/nosetests.py -v \
+ $COVERAGE_ARG \
--with-nosehtml --html-report-file run_unit_tests.html \
--with-doctest --exclude=functional --exclude="^get" \
- --exclude=controllers --exclude=runners
+ --exclude=controllers --exclude=runners lib test/unit
diff -r dc6e0347edffb96fe4e633b362ad21a9f5a83e81 -r 682bc706f5d6c8caab7a46e405cdee158268c373 test/TESTING.md
--- /dev/null
+++ b/test/TESTING.md
@@ -0,0 +1,7 @@
+Galaxy Testing
+==============
+
+The Galaxy code base is large and contains many kinds of tests. Please
+consult the [Galaxy
+wiki](http://wiki.galaxyproject.org/Admin/Running%20Tests) for more
+information on testing Galaxy.
diff -r dc6e0347edffb96fe4e633b362ad21a9f5a83e81 -r 682bc706f5d6c8caab7a46e405cdee158268c373 test/unit/test_tool_loader.py
--- /dev/null
+++ b/test/unit/test_tool_loader.py
@@ -0,0 +1,191 @@
+from tempfile import mkdtemp
+from shutil import rmtree
+import os
+
+from galaxy.util import parse_xml
+from galaxy.tools.loader import template_macro_params, load_tool
+
+def test_loader():
+
+ class TestToolDirectory(object):
+ def __init__(self):
+ self.temp_directory = mkdtemp()
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, tb):
+ rmtree(self.temp_directory)
+
+ def write(self, contents, name="tool.xml"):
+ open(os.path.join(self.temp_directory, name), "w").write(contents)
+
+ def load(self, name="tool.xml", preprocess=True):
+ if preprocess:
+ loader = load_tool
+ else:
+ loader = parse_xml
+ return loader(os.path.join(self.temp_directory, name))
+
+ ## Test simple macro replacement.
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs" />
+ <macros>
+ <macro name="inputs">
+ <inputs />
+ </macro>
+ </macros>
+</tool>''')
+ xml = tool_dir.load(preprocess=False)
+ assert xml.find("inputs") is None
+ xml = tool_dir.load(preprocess=True)
+ assert xml.find("inputs") is not None
+
+ # Test importing macros from external files
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs" />
+ <macros>
+ <import>external.xml</import>
+ </macros>
+</tool>''')
+
+ tool_dir.write('''
+<macros>
+ <macro name="inputs">
+ <inputs />
+ </macro>
+</macros>''', name="external.xml")
+ xml = tool_dir.load(preprocess=False)
+ assert xml.find("inputs") is None
+ xml = tool_dir.load(preprocess=True)
+ assert xml.find("inputs") is not None
+
+ # Test macros with unnamed yield statements.
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs">
+ <input name="first_input" />
+ </expand>
+ <macros>
+ <macro name="inputs">
+ <inputs>
+ <yield />
+ </inputs>
+ </macro>
+ </macros>
+</tool>''')
+ xml = tool_dir.load()
+ assert xml.find("inputs").find("input").get("name") == "first_input"
+
+ # Test recursive macro applications.
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs">
+ <input name="first_input" />
+ <expand macro="second" />
+ </expand>
+ <macros>
+ <macro name="inputs">
+ <inputs>
+ <yield />
+ </inputs>
+ </macro>
+ <macro name="second">
+ <input name="second_input" />
+ </macro>
+ </macros>
+</tool>''')
+ xml = tool_dir.load()
+ assert xml.find("inputs").findall("input")[1].get("name") == "second_input"
+
+ # Test recursive macro applications.
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs">
+ <input name="first_input" />
+ <expand macro="second" />
+ </expand>
+ <macros>
+ <macro name="inputs">
+ <inputs>
+ <yield />
+ </inputs>
+ </macro>
+ <macro name="second">
+ <expand macro="second_delegate" />
+ </macro>
+ <macro name="second_delegate">
+ <input name="second_input" />
+ </macro>
+ </macros>
+</tool>''')
+ xml = tool_dir.load()
+ assert xml.find("inputs").findall("input")[1].get("name") == "second_input"
+
+ # Test <xml> is shortcut for macro type="xml"
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs" />
+ <macros>
+ <xml name="inputs">
+ <inputs />
+ </xml>
+ </macros>
+</tool>''')
+ xml = tool_dir.load()
+ assert xml.find("inputs") is not None
+
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <command interpreter="python">tool_wrapper.py
+ #include source=$tool_params
+ </command>
+ <macros>
+ <template name="tool_params">-a 1 -b 2</template>
+ </macros>
+</tool>
+''')
+ xml = tool_dir.load()
+ params_dict = template_macro_params(xml.getroot())
+ assert params_dict['tool_params'] == "-a 1 -b 2"
+
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <macros>
+ <token name="@CITATION@">The citation.</token>
+ </macros>
+ <help>@CITATION@</help>
+ <another>
+ <tag />
+ </another>
+</tool>
+''')
+ xml = tool_dir.load()
+ help_el = xml.find("help")
+ assert help_el.text == "The citation.", help_el.text
+
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <macros>
+ <token name="@TAG_VAL@">The value.</token>
+ </macros>
+ <another>
+ <tag value="@TAG_VAL@" />
+ </another>
+</tool>
+''')
+ xml = tool_dir.load()
+ tag_el = xml.find("another").find("tag")
+ value = tag_el.get('value')
+ assert value == "The value.", value
https://bitbucket.org/galaxy/galaxy-central/commits/71bd004a3354/
Changeset: 71bd004a3354
User: jmchilton
Date: 2013-06-24 16:29:46
Summary: Update README.txt to reflect Python 2.5 is no longer supported.
Affected #: 1 file
diff -r 682bc706f5d6c8caab7a46e405cdee158268c373 -r 71bd004a3354b7132db03cb17b6a45997677e100 README.txt
--- a/README.txt
+++ b/README.txt
@@ -7,7 +7,7 @@
HOW TO START
============
-Galaxy requires Python 2.5, 2.6 or 2.7. To check your python version, run:
+Galaxy requires Python 2.6 or 2.7. To check your python version, run:
% python -V
Python 2.7.3
https://bitbucket.org/galaxy/galaxy-central/commits/6673bd3bf457/
Changeset: 6673bd3bf457
User: dannon
Date: 2013-07-01 11:53:46
Summary: Merged in jmchilton/galaxy-central-multi-input-tool-fixes-2 (pull request #189)
Small Unit Testing Improvements
Affected #: 7 files
diff -r 9ddb3130b98d450ca2be3f447f171ff5f192b8a1 -r 6673bd3bf4571c4134797077ca85350a6319e444 .coveragerc
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,3 @@
+[run]
+branch = True
+include = lib/galaxy/*
diff -r 9ddb3130b98d450ca2be3f447f171ff5f192b8a1 -r 6673bd3bf4571c4134797077ca85350a6319e444 .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -82,6 +82,9 @@
# Test output
run_functional_tests.html
test/tool_shed/tmp/*
+.coverage
+htmlcov
+run_unit_tests.html
# Project files
*.kpf
diff -r 9ddb3130b98d450ca2be3f447f171ff5f192b8a1 -r 6673bd3bf4571c4134797077ca85350a6319e444 README.txt
--- a/README.txt
+++ b/README.txt
@@ -7,7 +7,7 @@
HOW TO START
============
-Galaxy requires Python 2.5, 2.6 or 2.7. To check your python version, run:
+Galaxy requires Python 2.6 or 2.7. To check your python version, run:
% python -V
Python 2.7.3
diff -r 9ddb3130b98d450ca2be3f447f171ff5f192b8a1 -r 6673bd3bf4571c4134797077ca85350a6319e444 lib/galaxy/tools/loader.py
--- a/lib/galaxy/tools/loader.py
+++ b/lib/galaxy/tools/loader.py
@@ -202,199 +202,3 @@
current_index += 1
parent_el.insert(current_index, deepcopy(target))
parent_el.remove(query)
-
-
-def test_loader():
- """
- Function to test this module. Galaxy doesn't seem to have a
- place to put unit tests that are not doctests. These tests can
- be run with nosetests via the following command:
-
- % nosetests lib/galaxy/tools/loader.py
-
- """
- from tempfile import mkdtemp
- from shutil import rmtree
-
- class TestToolDirectory(object):
- def __init__(self):
- self.temp_directory = mkdtemp()
-
- def __enter__(self):
- return self
-
- def __exit__(self, type, value, tb):
- rmtree(self.temp_directory)
-
- def write(self, contents, name="tool.xml"):
- open(os.path.join(self.temp_directory, name), "w").write(contents)
-
- def load(self, name="tool.xml", preprocess=True):
- if preprocess:
- loader = load_tool
- else:
- loader = parse_xml
- return loader(os.path.join(self.temp_directory, name))
-
- ## Test simple macro replacement.
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs" />
- <macros>
- <macro name="inputs">
- <inputs />
- </macro>
- </macros>
-</tool>''')
- xml = tool_dir.load(preprocess=False)
- assert xml.find("inputs") is None
- xml = tool_dir.load(preprocess=True)
- assert xml.find("inputs") is not None
-
- # Test importing macros from external files
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs" />
- <macros>
- <import>external.xml</import>
- </macros>
-</tool>''')
-
- tool_dir.write('''
-<macros>
- <macro name="inputs">
- <inputs />
- </macro>
-</macros>''', name="external.xml")
- xml = tool_dir.load(preprocess=False)
- assert xml.find("inputs") is None
- xml = tool_dir.load(preprocess=True)
- assert xml.find("inputs") is not None
-
- # Test macros with unnamed yield statements.
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs">
- <input name="first_input" />
- </expand>
- <macros>
- <macro name="inputs">
- <inputs>
- <yield />
- </inputs>
- </macro>
- </macros>
-</tool>''')
- xml = tool_dir.load()
- assert xml.find("inputs").find("input").get("name") == "first_input"
-
- # Test recursive macro applications.
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs">
- <input name="first_input" />
- <expand macro="second" />
- </expand>
- <macros>
- <macro name="inputs">
- <inputs>
- <yield />
- </inputs>
- </macro>
- <macro name="second">
- <input name="second_input" />
- </macro>
- </macros>
-</tool>''')
- xml = tool_dir.load()
- assert xml.find("inputs").findall("input")[1].get("name") == "second_input"
-
- # Test recursive macro applications.
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs">
- <input name="first_input" />
- <expand macro="second" />
- </expand>
- <macros>
- <macro name="inputs">
- <inputs>
- <yield />
- </inputs>
- </macro>
- <macro name="second">
- <expand macro="second_delegate" />
- </macro>
- <macro name="second_delegate">
- <input name="second_input" />
- </macro>
- </macros>
-</tool>''')
- xml = tool_dir.load()
- assert xml.find("inputs").findall("input")[1].get("name") == "second_input"
-
- # Test <xml> is shortcut for macro type="xml"
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <expand macro="inputs" />
- <macros>
- <xml name="inputs">
- <inputs />
- </xml>
- </macros>
-</tool>''')
- xml = tool_dir.load()
- assert xml.find("inputs") is not None
-
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <command interpreter="python">tool_wrapper.py
- #include source=$tool_params
- </command>
- <macros>
- <template name="tool_params">-a 1 -b 2</template>
- </macros>
-</tool>
-''')
- xml = tool_dir.load()
- params_dict = template_macro_params(xml.getroot())
- assert params_dict['tool_params'] == "-a 1 -b 2"
-
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <macros>
- <token name="@CITATION@">The citation.</token>
- </macros>
- <help>@CITATION@</help>
- <another>
- <tag />
- </another>
-</tool>
-''')
- xml = tool_dir.load()
- help_el = xml.find("help")
- assert help_el.text == "The citation.", help_el.text
-
- with TestToolDirectory() as tool_dir:
- tool_dir.write('''
-<tool>
- <macros>
- <token name="@TAG_VAL@">The value.</token>
- </macros>
- <another>
- <tag value="@TAG_VAL@" />
- </another>
-</tool>
-''')
- xml = tool_dir.load()
- tag_el = xml.find("another").find("tag")
- value = tag_el.get('value')
- assert value == "The value.", value
diff -r 9ddb3130b98d450ca2be3f447f171ff5f192b8a1 -r 6673bd3bf4571c4134797077ca85350a6319e444 run_unit_tests.sh
--- a/run_unit_tests.sh
+++ b/run_unit_tests.sh
@@ -3,7 +3,14 @@
## Excluding controllers due to the problematic genetrack dependency
## Excluding job runners due to various external dependencies
-python ./scripts/nosetests.py -v -w lib \
+COVERAGE=`which coverage`
+COVERAGE_ARG=""
+if [ $COVERAGE ]; then
+ COVERAGE_ARG="--with-coverage"
+fi
+
+python ./scripts/nosetests.py -v \
+ $COVERAGE_ARG \
--with-nosehtml --html-report-file run_unit_tests.html \
--with-doctest --exclude=functional --exclude="^get" \
- --exclude=controllers --exclude=runners
+ --exclude=controllers --exclude=runners lib test/unit
diff -r 9ddb3130b98d450ca2be3f447f171ff5f192b8a1 -r 6673bd3bf4571c4134797077ca85350a6319e444 test/TESTING.md
--- /dev/null
+++ b/test/TESTING.md
@@ -0,0 +1,7 @@
+Galaxy Testing
+==============
+
+The Galaxy code base is large and contains many kinds of tests. Please
+consult the [Galaxy
+wiki](http://wiki.galaxyproject.org/Admin/Running%20Tests) for more
+information on testing Galaxy.
diff -r 9ddb3130b98d450ca2be3f447f171ff5f192b8a1 -r 6673bd3bf4571c4134797077ca85350a6319e444 test/unit/test_tool_loader.py
--- /dev/null
+++ b/test/unit/test_tool_loader.py
@@ -0,0 +1,191 @@
+from tempfile import mkdtemp
+from shutil import rmtree
+import os
+
+from galaxy.util import parse_xml
+from galaxy.tools.loader import template_macro_params, load_tool
+
+def test_loader():
+
+ class TestToolDirectory(object):
+ def __init__(self):
+ self.temp_directory = mkdtemp()
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, tb):
+ rmtree(self.temp_directory)
+
+ def write(self, contents, name="tool.xml"):
+ open(os.path.join(self.temp_directory, name), "w").write(contents)
+
+ def load(self, name="tool.xml", preprocess=True):
+ if preprocess:
+ loader = load_tool
+ else:
+ loader = parse_xml
+ return loader(os.path.join(self.temp_directory, name))
+
+ ## Test simple macro replacement.
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs" />
+ <macros>
+ <macro name="inputs">
+ <inputs />
+ </macro>
+ </macros>
+</tool>''')
+ xml = tool_dir.load(preprocess=False)
+ assert xml.find("inputs") is None
+ xml = tool_dir.load(preprocess=True)
+ assert xml.find("inputs") is not None
+
+ # Test importing macros from external files
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs" />
+ <macros>
+ <import>external.xml</import>
+ </macros>
+</tool>''')
+
+ tool_dir.write('''
+<macros>
+ <macro name="inputs">
+ <inputs />
+ </macro>
+</macros>''', name="external.xml")
+ xml = tool_dir.load(preprocess=False)
+ assert xml.find("inputs") is None
+ xml = tool_dir.load(preprocess=True)
+ assert xml.find("inputs") is not None
+
+ # Test macros with unnamed yield statements.
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs">
+ <input name="first_input" />
+ </expand>
+ <macros>
+ <macro name="inputs">
+ <inputs>
+ <yield />
+ </inputs>
+ </macro>
+ </macros>
+</tool>''')
+ xml = tool_dir.load()
+ assert xml.find("inputs").find("input").get("name") == "first_input"
+
+ # Test recursive macro applications.
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs">
+ <input name="first_input" />
+ <expand macro="second" />
+ </expand>
+ <macros>
+ <macro name="inputs">
+ <inputs>
+ <yield />
+ </inputs>
+ </macro>
+ <macro name="second">
+ <input name="second_input" />
+ </macro>
+ </macros>
+</tool>''')
+ xml = tool_dir.load()
+ assert xml.find("inputs").findall("input")[1].get("name") == "second_input"
+
+ # Test recursive macro applications.
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs">
+ <input name="first_input" />
+ <expand macro="second" />
+ </expand>
+ <macros>
+ <macro name="inputs">
+ <inputs>
+ <yield />
+ </inputs>
+ </macro>
+ <macro name="second">
+ <expand macro="second_delegate" />
+ </macro>
+ <macro name="second_delegate">
+ <input name="second_input" />
+ </macro>
+ </macros>
+</tool>''')
+ xml = tool_dir.load()
+ assert xml.find("inputs").findall("input")[1].get("name") == "second_input"
+
+ # Test <xml> is shortcut for macro type="xml"
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <expand macro="inputs" />
+ <macros>
+ <xml name="inputs">
+ <inputs />
+ </xml>
+ </macros>
+</tool>''')
+ xml = tool_dir.load()
+ assert xml.find("inputs") is not None
+
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <command interpreter="python">tool_wrapper.py
+ #include source=$tool_params
+ </command>
+ <macros>
+ <template name="tool_params">-a 1 -b 2</template>
+ </macros>
+</tool>
+''')
+ xml = tool_dir.load()
+ params_dict = template_macro_params(xml.getroot())
+ assert params_dict['tool_params'] == "-a 1 -b 2"
+
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <macros>
+ <token name="@CITATION@">The citation.</token>
+ </macros>
+ <help>@CITATION@</help>
+ <another>
+ <tag />
+ </another>
+</tool>
+''')
+ xml = tool_dir.load()
+ help_el = xml.find("help")
+ assert help_el.text == "The citation.", help_el.text
+
+ with TestToolDirectory() as tool_dir:
+ tool_dir.write('''
+<tool>
+ <macros>
+ <token name="@TAG_VAL@">The value.</token>
+ </macros>
+ <another>
+ <tag value="@TAG_VAL@" />
+ </another>
+</tool>
+''')
+ xml = tool_dir.load()
+ tag_el = xml.find("another").find("tag")
+ value = tag_el.get('value')
+ assert value == "The value.", value
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.
1
0