Esempio n. 1
0
def test_walk_file_older_than() -> None:
    _teardown()
    TMP_ROOT.mkdir()
    path = TMP_ROOT / "text.txt"
    path.touch()
    walk_after = path.stat().st_mtime
    wos = Walk(Settings())
    res = wos.walk_file(path, walk_after)
    assert len(res) == 0
    _teardown()
Esempio n. 2
0
def test_walk_file_dir() -> None:
    _teardown()
    dir_path = TMP_ROOT / "deep"
    dir_path.mkdir(parents=True)
    path = dir_path / "test.txt"
    path.touch()
    settings = Settings()
    wos = Walk(settings)
    res = wos.walk_file(dir_path, None)
    assert len(res) == 0
    _teardown()
Esempio n. 3
0
def test_walk_file_list_only() -> None:
    _teardown()
    TMP_ROOT.mkdir()
    path = TMP_ROOT / "test.jpg"
    shutil.copy(TEST_JPG_SRC, path)
    path.touch()
    settings = Settings()
    settings.list_only = True
    wos = Walk(settings)
    res = wos.walk_file(path, None)
    assert len(res) == 0
    _teardown()
Esempio n. 4
0
def test_walk_file_comic() -> None:
    _teardown()
    TMP_ROOT.mkdir()
    path = TMP_ROOT / "test.cbr"
    shutil.copy(TEST_CBR_SRC, path)
    settings = Settings(None, Namespace(comics=True, bigger=True))
    wos = Walk(settings)
    res = wos.walk_file(path, None)
    assert len(res) == 1
    rep = res.pop().get()
    wos._pool.close()
    wos._pool.join()
    assert rep.final_path == path.with_suffix(".cbz")
    _teardown()