test: тик убирает downloads/ раз в сутки (#87)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
36f6bd6075
commit
751ae885db
@ -753,6 +753,26 @@ def test_tick_sweeps_files_once_a_day(hub, tmp_path, monkeypatch):
|
||||
assert len(calls) == 2
|
||||
|
||||
|
||||
def test_tick_sweeps_downloads_once_a_day(hub):
|
||||
h = hub["hub"]
|
||||
old = time.time() - 31 * 86400
|
||||
|
||||
def put_old(name):
|
||||
d = h.db_path.parent / "downloads" / name
|
||||
d.mkdir(parents=True)
|
||||
(d / "a.png").write_bytes(b"x")
|
||||
os.utime(d / "a.png", (old, old))
|
||||
os.utime(d, (old, old))
|
||||
return d
|
||||
|
||||
first = put_old("1")
|
||||
h.tick()
|
||||
assert not first.exists() and "downloads_at" in h.module_state["jira"]
|
||||
second = put_old("2")
|
||||
h.tick()
|
||||
assert second.exists() # второй тик в те же сутки — без уборки
|
||||
|
||||
|
||||
def test_tick_sweep_failure_logged_auto_refresh_still_runs(hub, monkeypatch, caplog, add_project):
|
||||
_add_project(hub, add_project)
|
||||
def broken(*args, **kwargs):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user