diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-05-16 10:04:53 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-05-17 12:11:02 +0300 |
commit | f276c028dd4869a97129140cea28f02f3889ac47 (patch) | |
tree | f354dde229b1cd41e75e3aaa76c9487766bce7c6 /subplot.py | |
parent | 0402565f12623fb56da54e9a9a764edb39129186 (diff) | |
download | subplot-f276c028dd4869a97129140cea28f02f3889ac47.tar.gz |
feat(subplot.md): add acceptance criteria for cleanup functionality
Add acceptance checks for the cleanup functionality, for Python and
Bash templates.
Diffstat (limited to 'subplot.py')
-rw-r--r-- | subplot.py | 30 |
1 files changed, 26 insertions, 4 deletions
@@ -35,14 +35,14 @@ def run_docgen_with_date(ctx, md=None, output=None, date=None): exit_code_zero(ctx) -def try_codegen_and_program(ctx, filename=None): +def try_codegen_and_program(ctx, filename=None, testprog=None): codegen = binary("sp-codegen") tmpldir = os.path.join(srcdir, "templates") - runcmd(ctx, [codegen, filename, "-o", "test.py", "--run", "--templates", tmpldir]) + runcmd(ctx, [codegen, filename, "-o", testprog, "--run", "--templates", tmpldir]) -def run_codegen_and_program(ctx, filename=None): - try_codegen_and_program(ctx, filename=filename) +def run_codegen_and_program(ctx, filename=None, testprog=None): + try_codegen_and_program(ctx, filename=filename, testprog=testprog) exit_code_zero(ctx) @@ -111,6 +111,28 @@ def step_was_run(ctx, keyword=None, name=None): stdout_matches(ctx, pattern="\n step: {} {}\n".format(keyword, name)) +def step_was_run_and_then(ctx, keyword1=None, name1=None, keyword2=None, name2=None): + stdout_matches( + ctx, + pattern="\n step: {} {}\n step: {} {}".format( + keyword1, name1, keyword2, name2 + ), + ) + + +def cleanup_was_run(ctx, keyword1=None, name1=None, keyword2=None, name2=None): + stdout_matches( + ctx, + pattern="\n cleanup: {} {}\n cleanup: {} {}\n".format( + keyword1, name1, keyword2, name2 + ), + ) + + +def cleanup_was_not_run(ctx, keyword=None, name=None): + stdout_does_not_match(ctx, pattern="\n cleanup: {} {}\n".format(keyword, name)) + + def exit_code_zero(ctx): if ctx.get("exit") != 0: print("context:", ctx.as_dict()) |