Commit f6a4d522 authored by Jan Kiene's avatar Jan Kiene
Browse files

add better reporting of reason for diff

parent ba56efec
Loading
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -129,11 +129,14 @@ def test_26252(test_tag, encoder_path, decoder_path, renderer_path, isar_post_re

    diff_opts = replace_paths(diff_opts, testv_path, ref_path, cut_path)
    result = True

    suffix = ""
    for cmd in diff_opts.split(';'):
        file_a = Path(cmd.split()[1])
        file_b = Path(cmd.split()[2])

        assert file_a.suffix == file_b.suffix
        suffix = file_a.suffix
        assert suffix == file_b.suffix
        if Path(file_a).suffix == ".csv":
            with open(file_a, "r") as f_a:
                with open(file_b, "r") as f_b:
@@ -142,6 +145,17 @@ def test_26252(test_tag, encoder_path, decoder_path, renderer_path, isar_post_re
                    result = result and a_content == b_content
        else:
            result = result and filecmp.cmp(file_a, file_b)

    if not result:
        assert False, "Output differs" 
        result_str = "Output differs in: "
        if suffix == ".csv":
            result_str += "object metadata"
        elif suffix == ".met":
            result_str += "MASA metadata"
        elif suffix == ".wav":
            result_str += "waveform"
        else:
            assert False, f"Either no diff commands were found or the output files had an incorrect suffix. \ncmd: {cmd}"

        pytest.fail(result_str)