예제 #1
0
    def log_redefine_xml_diff(obj, origxml, newxml):
        if origxml == newxml:
            log.debug("Redefine requested for %s, but XML didn't change!", obj)
            return

        diff = xmlutil.diff(origxml, newxml, "Original XML", "New XML")
        log.debug("Redefining %s with XML diff:\n%s", obj, diff)
예제 #2
0
def diff_compare(actual_out, filename=None, expect_out=None):
    """Compare passed string output to contents of filename"""
    if not expect_out:
        if not os.path.exists(filename) or TESTCONFIG.regenerate_output:
            open(filename, "w").write(actual_out)
        expect_out = open(filename).read()

    diff = xmlutil.diff(expect_out, actual_out,
            filename or '', "Generated output")
    if diff:
        raise AssertionError("Conversion outputs did not match.\n%s" % diff)