Mercurial > repos > shellac > sam_consensus_v3
diff env/lib/python3.9/site-packages/planemo/engine/test.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/env/lib/python3.9/site-packages/planemo/engine/test.py Mon Mar 22 18:12:50 2021 +0000 @@ -0,0 +1,36 @@ +from planemo.engine import ( + engine_context, +) +from planemo.galaxy import galaxy_config +from planemo.galaxy.config import _find_test_data +from planemo.galaxy.test import ( + handle_reports_and_summary, + run_in_config, +) +from planemo.runnable import ( + for_paths, + RunnableType, +) + + +def test_runnables(ctx, runnables, original_paths=None, **kwds): + """Return exit code indicating test or failure.""" + engine_type = kwds["engine"] + test_engine_testable = {RunnableType.galaxy_tool, RunnableType.galaxy_datamanager, RunnableType.directory} + enable_test_engines = any(r.type not in test_engine_testable for r in runnables) + enable_test_engines = enable_test_engines or engine_type != "galaxy" + if enable_test_engines: + ctx.vlog("Using test engine type %s" % engine_type) + with engine_context(ctx, **kwds) as engine: + test_data = engine.test(runnables) + ctx.vlog("engine.test returning [%s]" % test_data) + return_value = handle_reports_and_summary(ctx, test_data.structured_data, kwds=kwds) + else: + ctx.vlog("Running traditional Galaxy tool tests using run_tests.sh in Galaxy root %s" % engine_type) + kwds["for_tests"] = True + if kwds.get('update_test_data'): + non_copied_runnables = for_paths(original_paths) + kwds['test_data_target_dir'] = _find_test_data(non_copied_runnables, **kwds) + with galaxy_config(ctx, runnables, **kwds) as config: + return_value = run_in_config(ctx, config, **kwds) + return return_value