Skip to content

Commit 572e754

Browse files
committed
Fix a couple issues with producing test outputs.
1 parent 5d7db92 commit 572e754

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

planemo/galaxy_test/actions.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,18 @@ def run_in_config(ctx, config, **kwds):
8383
test_data = test_results.structured_data
8484

8585
if 'test_output' in kwds:
86-
with open(kwds['test_output'], 'w') as handle:
87-
handle.write(build_report.build_report(test_data))
86+
output_path = kwds['test_output']
87+
if output_path is not None:
88+
with open(output_path, 'w') as handle:
89+
handle.write(build_report.build_report(test_data))
8890

8991
for kw_name in ('markdown', 'text'):
9092
if 'test_output_%s' % kw_name in kwds:
91-
with open(kwds['test_output_%s' % kw_name], 'w') as handle:
93+
output_path = kwds['test_output_%s' % kw_name]
94+
if output_path is None:
95+
continue
96+
97+
with open(output_path, 'w') as handle:
9298
handle.write(build_report.build_report(test_data, report_type=kw_name))
9399

94100
except Exception:

planemo/reports/build_report.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
from pkg_resources import resource_string
23
from jinja2 import Environment, PackageLoader
34
env = Environment(loader=PackageLoader('planemo', 'reports'))
@@ -20,6 +21,7 @@ def build_report(structured_data, report_type="html", **kwds):
2021
'bootstrap_style': __style("bootstrap.min.css"),
2122
'jquery_script': __script("jquery.min"),
2223
'bootstrap_script': __script("bootstrap.min"),
24+
'json': json,
2325
})
2426

2527
return template_data(environment, 'report_%s.tpl' % report_type)

planemo/reports/report_html.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
.success(function(content) { renderTestResults( $.parseJSON(content) ); })
7979
.failure(function() { alert("Failed to load test data.")} );
8080
} else {
81-
var test_data = {{ raw_data | to_json }};
81+
var test_data = {{ json.dumps(raw_data) }};
8282
renderTestResults(test_data);
8383
}
8484
</script>

0 commit comments

Comments
 (0)