def test_walk_all_files_empty() -> None: _teardown() wos = Walk(Settings()) record_dirs, bytes_in, bytes_out, nag, errors = wos._walk_all_files() assert len(record_dirs) == 0 assert bytes_in == 0 assert bytes_out == 0 assert not nag assert len(errors) == 0 _teardown()
def test_walk_all_files_one() -> None: _teardown() TMP_ROOT.mkdir() path = TMP_ROOT / "test.jpg" shutil.copy(TEST_JPG_SRC, path) wos = Walk(Settings(None, Namespace(paths=[TMP_ROOT], recurse=True))) record_dirs, bytes_in, bytes_out, nag, errors = wos._walk_all_files() assert len(record_dirs) == 1 assert bytes_in == 97373 assert bytes_out == 87922 assert not nag assert len(errors) == 0 _teardown()
def test_walk_all_files_two() -> None: _teardown() root1 = TMP_ROOT / "dir1" root1.mkdir(parents=True) path1 = root1 / "test.jpg" shutil.copy(TEST_JPG_SRC, path1) root2 = TMP_ROOT / "dir2" root2.mkdir() path2 = root2 / "test.jpg" shutil.copy(TEST_JPG_SRC, path2) wos = Walk(Settings(None, Namespace(paths=[root1, root2], recurse=True))) record_dirs, bytes_in, bytes_out, nag, errors = wos._walk_all_files() assert len(record_dirs) == 2 assert bytes_in == 194746 assert bytes_out == 175844 assert not nag assert len(errors) == 0 _teardown()
def test_walk_all_files_error() -> None: _teardown() TMP_ROOT.mkdir() path = TMP_ROOT / "test.gif" shutil.copy(TEST_GIF_SRC, path) settings = Settings( None, Namespace( paths=[TMP_ROOT], gifsicle=False, optipng=False, pngout=False, recurse=True ), ) wos = Walk(settings) record_dirs, bytes_in, bytes_out, nag, errors = wos._walk_all_files() assert len(record_dirs) == 1 assert bytes_in == 0 assert bytes_out == 0 assert not nag assert len(errors) == 1 _teardown()