4
4
import click
5
5
6
6
from . import structures as test_structures
7
- from planemo .io import info , warn , shell_join
7
+ from planemo .io import error , info , warn , shell_join
8
8
from planemo .galaxy .run import (
9
9
run_galaxy_command ,
10
10
setup_venv ,
14
14
15
15
from galaxy .tools .deps .commands import shell
16
16
17
- XUNIT_UPGRADE_MESSAGE = ("This version of Galaxy does not support xUnit - "
18
- "please update to newest development brach." )
19
- NO_XUNIT_MESSAGE = ( "Cannot locate xUnit report option for tests - update "
20
- "Galaxy for more detailed breakdown." )
21
- NO_JSON_MESSAGE = ( "Cannot locate json report option for tests - update "
22
- "Galaxy for more detailed breakdown ." )
17
+ NO_XUNIT_REPORT_MESSAGE = ("Cannot locate xUnit report [%s] for tests - "
18
+ "required to build planemo report and summarize "
19
+ "tests." )
20
+ NO_JSON_REPORT_MESSAGE = ( "Cannot locate JSON report [%s] for tests - "
21
+ "required to build planemo report and summarize "
22
+ "tests ." )
23
23
NO_TESTS_MESSAGE = "No tests were executed - see Galaxy output for details."
24
24
ALL_TESTS_PASSED_MESSAGE = "All %d test(s) executed passed."
25
25
PROBLEM_COUNT_MESSAGE = ("There were problems with %d test(s) - out of %d "
29
29
GENERIC_TESTS_PASSED_MESSAGE = "No failing tests encountered."
30
30
31
31
32
- def run_in_config (ctx , config , ** kwds ):
32
+ def run_in_config (ctx , config , run = run_galaxy_command , ** kwds ):
33
33
"""Run Galaxy tests with the run_tests.sh command.
34
34
35
35
The specified `config` object describes the context for tool
@@ -42,7 +42,7 @@ def run_in_config(ctx, config, **kwds):
42
42
if job_output_files is None :
43
43
job_output_files = os .path .join (config_directory , "jobfiles" )
44
44
45
- xunit_supported , xunit_report_file = _xunit_state (kwds , config )
45
+ xunit_report_file = _xunit_state (kwds , config )
46
46
structured_report_file = _structured_report_file (kwds , config )
47
47
48
48
info ("Testing using galaxy_root %s" , config .galaxy_root )
@@ -75,7 +75,7 @@ def run_in_config(ctx, config, **kwds):
75
75
test_cmd ,
76
76
)
77
77
action = "Testing tools"
78
- return_code = run_galaxy_command (
78
+ return_code = run (
79
79
ctx ,
80
80
cmd ,
81
81
config .env ,
@@ -85,9 +85,15 @@ def run_in_config(ctx, config, **kwds):
85
85
update_cp_args = (job_output_files , config .test_data_dir )
86
86
shell ('cp -r "%s"/* "%s"' % update_cp_args )
87
87
88
- if xunit_report_file and (not os .path .exists (xunit_report_file )):
89
- warn (NO_XUNIT_MESSAGE )
90
- xunit_report_file = None
88
+ if not os .path .exists (xunit_report_file ):
89
+ message = NO_XUNIT_REPORT_MESSAGE % xunit_report_file
90
+ error (message )
91
+ raise Exception (message )
92
+
93
+ if not os .path .exists (structured_report_file ):
94
+ message = NO_JSON_REPORT_MESSAGE % structured_report_file
95
+ error (message )
96
+ raise Exception (message )
91
97
92
98
test_results = test_structures .GalaxyTestResults (
93
99
structured_report_file ,
@@ -243,33 +249,31 @@ def _print_command_line(structured_data, test_id):
243
249
244
250
245
251
def _xunit_state (kwds , config ):
246
- xunit_supported = True
247
- if shell ("grep -q xunit '%s'/run_tests.sh" % config .galaxy_root ):
248
- xunit_supported = False
252
+ # This has been supported in Galaxy for well over a year, just going to assume
253
+ # it from here on out.
254
+ # xunit_supported = True
255
+ # if shell("grep -q xunit '%s'/run_tests.sh" % config.galaxy_root):
256
+ # xunit_supported = False
249
257
250
258
xunit_report_file = kwds .get ("test_output_xunit" , None )
251
- if xunit_report_file is None and xunit_supported :
259
+ if xunit_report_file is None :
252
260
xunit_report_file = os .path .join (config .config_directory , "xunit.xml" )
253
- elif xunit_report_file is not None and not xunit_supported :
254
- warn (XUNIT_UPGRADE_MESSAGE )
255
- xunit_report_file = None
256
261
257
- return xunit_supported , xunit_report_file
262
+ return xunit_report_file
258
263
259
264
260
265
def _structured_report_file (kwds , config ):
261
- structured_data_supported = True
262
- if shell ("grep -q structured_data '%s'/run_tests.sh" % config .galaxy_root ):
263
- structured_data_supported = False
266
+ # This has been supported in Galaxy for well over a year, just going to assume
267
+ # it from here on out.
268
+ # structured_data_supported = True
269
+ # if shell("grep -q structured_data '%s'/run_tests.sh" % config.galaxy_root):
270
+ # structured_data_supported = False
264
271
265
272
structured_report_file = None
266
273
structured_report_file = kwds .get ("test_output_json" , None )
267
- if structured_report_file is None and structured_data_supported :
274
+ if structured_report_file is None :
268
275
conf_dir = config .config_directory
269
276
structured_report_file = os .path .join (conf_dir , "structured_data.json" )
270
- elif structured_report_file is not None and not structured_data_supported :
271
- warn (NO_JSON_MESSAGE )
272
- structured_report_file = None
273
277
274
278
return structured_report_file
275
279
0 commit comments