From 552d2a00ffa4e1131a1b49385c4a22a9a147363e Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Sat, 17 Aug 2013 12:18:48 -0700 Subject: [PATCH] Some testing goodies --- features/steps/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/features/steps/core.py b/features/steps/core.py index f6c54564..1b476a2a 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -66,15 +66,15 @@ def no_error(context): @then('the output should be parsable as json') def check_output_json(context): out = context.stdout_capture.getvalue() - assert json.loads(out) + assert json.loads(out), out @then('"{field}" in the json output should have {number:d} elements') @then('"{field}" in the json output should have 1 element') def check_output_field(context, field, number=1): out = context.stdout_capture.getvalue() out_json = json.loads(out) - assert field in out_json - assert len(out_json[field]) == number + assert field in out_json [field, out_json] + assert len(out_json[field]) == number, len(out_json[field]) @then('"{field}" in the json output should not contain "{key}"') def check_output_field_not_key(context, field, key): @@ -95,7 +95,7 @@ def check_output(context): text = context.text.strip().splitlines() out = context.stdout_capture.getvalue().strip().splitlines() for line_text, line_out in zip(text, out): - assert line_text.strip() == line_out.strip() + assert line_text.strip() == line_out.strip(), [line_text.strip(), line_out.strip()] @then('the output should contain "{text}"') def check_output_inline(context, text):