in-toto / demo

Securing Alice's, Bob's and Carl's software supply chain using in-toto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show output diff for test failures

lukpueh opened this issue · comments

The demo tests compare expected output to actual output of a demo run. If they differ, tests fail and both outputs are printed one after the other:

demo/run_demo_md.py

Lines 123 to 126 in 14d2558

if stdout != EXPECTED_STDOUT:
raise SystemExit(
"#### EXPECTED:\n-\n{}\n-\n#### GOT:\n-\n{}\n-\nDemo test failed due "
"to unexpected output (see above). :(".format(EXPECTED_STDOUT, stdout))

In order to more easily identify test failure reasons, it would be great to show something like a line diff of the outputs. Python's difflib should be able to do this.

Nicely addressed by @SolidifiedRay in #17.