comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 from planemo.engine import (
2 engine_context,
3 )
4 from planemo.galaxy import galaxy_config
5 from planemo.galaxy.config import _find_test_data
6 from planemo.galaxy.test import (
7 handle_reports_and_summary,
8 run_in_config,
9 )
10 from planemo.runnable import (
11 for_paths,
12 RunnableType,
13 )
14
15
16 def test_runnables(ctx, runnables, original_paths=None, **kwds):
17 """Return exit code indicating test or failure."""
18 engine_type = kwds["engine"]
19 test_engine_testable = {RunnableType.galaxy_tool, RunnableType.galaxy_datamanager, RunnableType.directory}
20 enable_test_engines = any(r.type not in test_engine_testable for r in runnables)
21 enable_test_engines = enable_test_engines or engine_type != "galaxy"
22 if enable_test_engines:
23 ctx.vlog("Using test engine type %s" % engine_type)
24 with engine_context(ctx, **kwds) as engine:
25 test_data = engine.test(runnables)
26 ctx.vlog("engine.test returning [%s]" % test_data)
27 return_value = handle_reports_and_summary(ctx, test_data.structured_data, kwds=kwds)
28 else:
29 ctx.vlog("Running traditional Galaxy tool tests using run_tests.sh in Galaxy root %s" % engine_type)
30 kwds["for_tests"] = True
31 if kwds.get('update_test_data'):
32 non_copied_runnables = for_paths(original_paths)
33 kwds['test_data_target_dir'] = _find_test_data(non_copied_runnables, **kwds)
34 with galaxy_config(ctx, runnables, **kwds) as config:
35 return_value = run_in_config(ctx, config, **kwds)
36 return return_value