From a5a474fd40c33295d766a176f0276da2d8fb4b36 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 22 Jun 2015 13:09:23 -0400 Subject: [PATCH] Add example and test case for job configuration expansion. First suggestion by @nsoranzo and second was easy once example was added to advanced config. --- config/job_conf.xml.sample_advanced | 18 ++++++++++++++++++ lib/galaxy/util/xml_macros.py | 1 - test/unit/jobs/test_job_configuration.py | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/config/job_conf.xml.sample_advanced b/config/job_conf.xml.sample_advanced index 132f9edff5b..444b7d2787e 100644 --- a/config/job_conf.xml.sample_advanced +++ b/config/job_conf.xml.sample_advanced @@ -442,6 +442,13 @@ false + + + + + 10GB + + + + SecureShell + Torque + galaxy + foohost_destination.example.org + walltime=@WALLTIME@,ncpus=@NCPUS@ + + + diff --git a/lib/galaxy/util/xml_macros.py b/lib/galaxy/util/xml_macros.py index aecc29227fa..56cfeba2d42 100644 --- a/lib/galaxy/util/xml_macros.py +++ b/lib/galaxy/util/xml_macros.py @@ -127,7 +127,6 @@ def _expand_macro(element, expand_el, macros, tokens): _expand_macros(expanded_elements, macros, tokens) macro_tokens = macro_def.macro_tokens(expand_el) if macro_tokens: - print macro_tokens _expand_tokens(expanded_elements, macro_tokens) # HACK for elementtree, newer implementations (etree/lxml) won't diff --git a/test/unit/jobs/test_job_configuration.py b/test/unit/jobs/test_job_configuration.py index b32d66280fb..6c51c2442a4 100644 --- a/test/unit/jobs/test_job_configuration.py +++ b/test/unit/jobs/test_job_configuration.py @@ -128,6 +128,12 @@ class JobConfXmlParserTestCase( unittest.TestCase ): assert env_dest.env[ 3 ][ "execute" ] == "module load javastuff/2.10" + def test_macro_expansion( self ): + self.__with_advanced_config() + for name in ["foo_small", "foo_medium", "foo_large", "foo_longrunning"]: + print self.job_config.destinations.keys() + assert self.job_config.destinations[ name ] + # TODO: Add job metrics parsing test. @property