diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-05-24 08:13:02 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-05-24 08:13:02 +0000 |
commit | 738c90cec0fd257334ec9e6e61314277286ea4e9 (patch) | |
tree | 0f09e6d77880b3673d6760e78642280d5de0c662 /subplot.py | |
parent | 576aa3bcbb6615f4fef73264029fc22af78fdfdc (diff) | |
parent | f039dc7fcb3e9dd20166ecfe64d5428a812d5990 (diff) | |
download | subplot-738c90cec0fd257334ec9e6e61314277286ea4e9.tar.gz |
Merge branch 'kinnison/fix-52' into 'master'
Support JSON output in `sp-meta`
Closes #52
See merge request larswirzenius/subplot!45
Diffstat (limited to 'subplot.py')
-rw-r--r-- | subplot.py | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1,3 +1,4 @@ +import json import os import re import subprocess @@ -54,6 +55,12 @@ def run_meta(ctx, filename=None): exit_code_is(ctx, 0) +def run_meta_json(ctx, filename=None): + meta = binary("sp-meta") + runcmd(ctx, [meta, filename, "-o", "json"]) + exit_code_is(ctx, 0) + + def run_pandoc_with_filter(ctx, filename=None, output=None): sp_filter = binary("sp-filter") runcmd(ctx, ["pandoc", "--filter", sp_filter, filename, "-o", output]) @@ -94,5 +101,11 @@ def cleanup_was_not_run(ctx, keyword=None, name=None): stdout_does_not_contain(ctx, pattern="\n cleanup: {} {}\n".format(keyword, name)) +def json_output_matches_file(ctx, filename=None): + actual = json.loads(ctx["stdout"]) + expected = json.load(open(filename)) + assert_dict_eq(actual, expected) + + def binary(basename): return os.path.join(srcdir, "target", "debug", basename) |