示例#1
0
def step_impl(context, first, second):
    full_path_first = prepend_installroot(context, first)
    full_path_second = prepend_installroot(context, second)
    f1 = find_file_by_glob(full_path_first)
    f2 = find_file_by_glob(full_path_second)
    found1 = read_file_contents(f1).strip()
    found2 = read_file_contents(f2).strip()
    if found1 == found2:
        return
    print_lines_diff(found1.split('\n'), found2.split('\n'))
    raise AssertionError("File '{}' contents differ from {}.".format(first, second))
示例#2
0
def file_contents_is(context, filepath):
    expected = context.text.strip()
    full_path = prepend_installroot(context, filepath)
    f = find_file_by_glob(full_path)
    found = read_file_contents(f).strip()
    if expected == found:
        return
    print_lines_diff(expected.split('\n'), found.split('\n'))
    raise AssertionError("File '{}' contents is different then expected.".format(filepath))
示例#3
0
def then_stdout_matches_line_by_line(context, filepath):
    """
    Checks that each line of given file matches respective line in regular expressions.
    """
    expected = context.text.split('\n')
    full_path = prepend_installroot(context, filepath)
    f = find_file_by_glob(full_path)
    found = read_file_contents(f).split('\n')

    lines_match_to_regexps_line_by_line(found, expected)
示例#4
0
def file_exists(context, filepath):
    full_path = prepend_installroot(context, filepath)
    find_file_by_glob(full_path)