Skip to content

Commit

Permalink
Fix a couple issues with producing test outputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Oct 12, 2015
1 parent 5d7db92 commit 572e754
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
12 changes: 9 additions & 3 deletions planemo/galaxy_test/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,18 @@ def run_in_config(ctx, config, **kwds):
test_data = test_results.structured_data

if 'test_output' in kwds:
with open(kwds['test_output'], 'w') as handle:
handle.write(build_report.build_report(test_data))
output_path = kwds['test_output']
if output_path is not None:
with open(output_path, 'w') as handle:
handle.write(build_report.build_report(test_data))

for kw_name in ('markdown', 'text'):
if 'test_output_%s' % kw_name in kwds:
with open(kwds['test_output_%s' % kw_name], 'w') as handle:
output_path = kwds['test_output_%s' % kw_name]
if output_path is None:
continue

with open(output_path, 'w') as handle:
handle.write(build_report.build_report(test_data, report_type=kw_name))

except Exception:
Expand Down
2 changes: 2 additions & 0 deletions planemo/reports/build_report.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
from pkg_resources import resource_string
from jinja2 import Environment, PackageLoader
env = Environment(loader=PackageLoader('planemo', 'reports'))
Expand All @@ -20,6 +21,7 @@ def build_report(structured_data, report_type="html", **kwds):
'bootstrap_style': __style("bootstrap.min.css"),
'jquery_script': __script("jquery.min"),
'bootstrap_script': __script("bootstrap.min"),
'json': json,
})

return template_data(environment, 'report_%s.tpl' % report_type)
Expand Down
2 changes: 1 addition & 1 deletion planemo/reports/report_html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
.success(function(content) { renderTestResults( $.parseJSON(content) ); })
.failure(function() { alert("Failed to load test data.")} );
} else {
var test_data = {{ raw_data | to_json }};
var test_data = {{ json.dumps(raw_data) }};
renderTestResults(test_data);
}
</script>
Expand Down

0 comments on commit 572e754

Please sign in to comment.