def step_output_should_match_file(context, file_):
with open(os.path.join(current_dir, file_)) as output:
if file_.endswith('.json'):
context.output = json.loads(context.output)
output = json.load(output)
try:
eq_(context.output, output)
except AssertionError:
print(str(DictDiffer(context.output, output)))
raise
else:
context = list(map(str.strip, context.output.splitlines()))
expected_result = list(map(str.strip, output.readlines()))
try:
eq_(context, expected_result)
except AssertionError:
d = difflib.Differ()
for line in d.compare(context, expected_result):
print(line)
raise
评论列表
文章目录