summaryrefslogtreecommitdiff
path: root/subplot.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-01-11 10:00:43 +0200
committerLars Wirzenius <liw@liw.fi>2020-01-11 10:00:43 +0200
commit56d5d9cb639463adb7dcfe011c54fe0d75e51348 (patch)
tree1425d6a9927c574d646a45f5781592c4b6bee374 /subplot.py
parent1af5fa0d171cc764b937c734a15b4533561f4d67 (diff)
downloadsubplot-56d5d9cb639463adb7dcfe011c54fe0d75e51348.tar.gz
Add: scenario for testing sp-meta
Diffstat (limited to 'subplot.py')
-rw-r--r--subplot.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/subplot.py b/subplot.py
index 287f819..f4549ee 100644
--- a/subplot.py
+++ b/subplot.py
@@ -17,6 +17,11 @@ def run_codegen(ctx, filename=None):
runcmd(ctx, [codegen, filename, '-o', 'test.py', '--run', '--templates', tmpldir])
exit_code_zero(ctx)
+def run_meta(ctx, filename=None):
+ meta = binary('sp-meta')
+ runcmd(ctx, [meta, filename])
+ exit_code_zero(ctx)
+
def run_pandoc_with_filter(ctx, filename=None, output=None):
sp_filter = binary('sp-filter')
runcmd(ctx, ['pandoc', '--filter', sp_filter, filename, '-o', output])
@@ -41,6 +46,8 @@ def step_was_run(ctx, keyword=None, name=None):
stdout_matches(ctx, '\n step: {}\n'.format(name))
def exit_code_zero(ctx):
+ if ctx.get('exit') != 0:
+ print('context:', ctx.as_dict())
assert_eq(ctx.get('exit'), 0)
def binary(basename):
@@ -53,6 +60,7 @@ def stdout_matches(ctx, pattern):
def runcmd(ctx, argv):
p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate("")
+ ctx['argv'] = argv
ctx['stdout'] = stdout.decode('utf-8')
ctx['stderr'] = stderr.decode('utf-8')
ctx['exit'] = p.returncode