From: Tomas Gavenciak Date: Wed, 22 Sep 2010 22:09:06 +0000 (+0200) Subject: Adapted test-pipeline runner in dummy tasktype to use "with parse" X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=5243c1b441662e2220a947537668dade658ac5fd;p=moe.git Adapted test-pipeline runner in dummy tasktype to use "with parse" Creating the text to be parsed is not really safe - testname must not include ', otherwise the parsing may fail Hmm ... Maybe another way? --- diff --git a/t/moe/tasktypes/dummy.py b/t/moe/tasktypes/dummy.py index 7f06418..72293c3 100644 --- a/t/moe/tasktypes/dummy.py +++ b/t/moe/tasktypes/dummy.py @@ -19,15 +19,17 @@ def init(e): e.log.info('Here we run test pipeline') tests = e['TESTS'].split() for t in tests: - e.log.info('Running test %s' % t) - e.log.user.info('TEST %s ...' % t) - - op = moe.config.Operation('SET', None, moe.config.ConfigExpression([t]), level=70, source='') - testvar = e.config.lookup('TEST') - # Add and remove operation setting 'TEST="..."' - testvar.add_operation(op) - e.test_pipe.run(e=e) - testvar.remove_operation(op) + e.log.info('Running test %s' % t) + e.log.user.info('TEST %s ...' % t) + with e.config.parse("TEST='"+t+"'", level=70, source=''): + e.test_pipe.run(e=e) + ## The old (but proper, as the above is vulnerable to injections by including "'" !) way was: + #op = moe.config.Operation('SET', None, moe.config.ConfigExpression([t]), level=70, source='') + #testvar = e.config.lookup('TEST') + ## Add and remove operation setting 'TEST="..."' + #testvar.add_operation(op) + #e.test_pipe.run(e=e) + #testvar.remove_operation(op) e.main_pipe.insert(60, 'dummy tasktype hook_m_60', hook_m_60)