Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
740 B
2
Indexable
Never
from pro_filer.actions.main_actions import find_duplicate_files  # NOQA
import os

def test_find_duplicate_files(tmp_path, capsys):
    foo = os.path.join(tmp_path, "foo.txt")

    with open(foo, "w") as f:
        f.write("smiley")

    bar = os.path.join(tmp_path, "bar.txt")

    with open(bar, "w") as f:
        f.write("smiley")

    baz = os.path.join(tmp_path, "baz.txt")

    with open(baz, "w") as f:
        f.write("baz")

    context = {
        "all_files": sorted([foo, bar, baz]),
    }

    result = find_duplicate_files(context)
    print(f"RESUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUULT: ", result)

    captured = capsys.readouterr()

    expected = [
        (f"{foo}", f"{bar}"),
    ]

    assert captured.out == expected
Leave a Comment