mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-10 12:38:32 +00:00
A synced request whose download failed, was interrupted by a restart, or was cancelled by the stall timer goes back to pending after AUTO_DOWNLOAD_RETRY_DAYS (7 by default, 0 turns it off), a few per pass, oldest first. Only what never arrived is retried, the failed release is remembered, and a request is given up on after three failed retries. Downloads cancelled by a person and rejected requests are never retried. Errors count as errors: a search that failed in one source no longer reads as no match, a throttled Hardcover lookup is an error and not a skip, and a request that blows up doesn't abort the pass. Both summaries carry the error count. A request for the same Hardcover book and format is skipped when the history already has a finished or running download for it. A request that finds nothing is searched once a day after three no-match passes, then every two days, up to AUTO_DOWNLOAD_BACKOFF_MAX_DAYS (3 by default, 0 turns it off).
27 lines
870 B
Python
27 lines
870 B
Python
"""Fixtures shared by the core tests."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from tests.core.fakes import FakeConfig
|
|
|
|
|
|
@pytest.fixture
|
|
def fake_app_config(monkeypatch: pytest.MonkeyPatch) -> FakeConfig:
|
|
"""Answer every config read from a dict the test controls.
|
|
|
|
Patches ``get`` on the config singleton, which each module imports as
|
|
``app_config``, so one patch covers all of them. The library-index cache is
|
|
emptied too, since entries cached under one test's config would leak into the
|
|
next. Turn it on for a whole module with
|
|
``pytestmark = pytest.mark.usefixtures("fake_app_config")``.
|
|
"""
|
|
from shelfmark.core import library_index
|
|
from shelfmark.core.config import config
|
|
|
|
fake = FakeConfig()
|
|
monkeypatch.setattr(config, "get", fake.get)
|
|
monkeypatch.setattr(library_index, "_cache", {})
|
|
return fake
|