comparison venv/lib/python2.7/site-packages/planemo/commands/cmd_test.py @ 0:d67268158946 draft

planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author bcclaywell
date Mon, 12 Oct 2015 17:43:33 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d67268158946
1 import sys
2
3 import click
4
5 from planemo.cli import pass_context
6 from planemo import options
7 from planemo import galaxy_config
8
9 from planemo.galaxy_test import (
10 run_in_config,
11 )
12
13
14 @click.command('test')
15 @options.optional_tools_arg(multiple=True)
16 @click.option(
17 "--failed",
18 is_flag=True,
19 help="Re-run only failed tests. This command will read "
20 "tool_test_output.json to determine which tests failed so this "
21 "file must have been produced with the same set of tool ids "
22 "previously.",
23 default=False,
24 )
25 @options.galaxy_target_options()
26 @options.galaxy_config_options()
27 @options.test_options()
28 @pass_context
29 def cli(ctx, paths, **kwds):
30 """Run the tests in the specified tool tests in a Galaxy instance.
31
32 All referenced tools (by default all the tools in the current working
33 directory) will be tested and the results quickly summarized.
34
35 To run these tests planemo needs a Galaxy instance to utilize, planemo
36 will search parent directories to see if any is a Galaxy instance
37 - but one can pick the Galaxy instance to use with the --galaxy_root
38 option or force planemo to download a disposable instance with the
39 ``--install_galaxy`` flag.
40
41 In additon to to quick summary printed to the console - various detailed
42 output summaries can be configured. ``tool_test_output.html`` (settable
43 via ``--test_output``) will contain a human consumable HTML report
44 describing the test run. A JSON file (settable via ``--test_output_json``
45 and defaulting to ``tool_test_output.json``) will also be created. These
46 files can can be disabled by passing in empty arguments or globally by
47 setting the values ``default_test_output`` and/or
48 ``default_test_output_json`` in ``~/.planemo.yml`` to ``null``. For
49 continuous integration testing a xUnit-style report can be confiured using
50 the ``--test_output_xunit``.
51
52 planemo uses temporarily generated config files and environment variables
53 to attempt to shield this execution of Galaxy from manually launched runs
54 against that same Galaxy root - but this may not be bullet proof yet so
55 please careful and do not try this against production Galaxy instances.
56 """
57 kwds["for_tests"] = True
58 with galaxy_config.galaxy_config(ctx, paths, **kwds) as config:
59 return_value = run_in_config(ctx, config, **kwds)
60 if return_value:
61 sys.exit(return_value)