mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-21 16:35:07 +00:00
fix: drop null vault keys, cap snapshot restore size, isolate test globals
Vaults.add_keys and kv add skip null content keys instead of failing the batch; is_null_key moves to core.vault. A manifest snapshot restore has one 32 MiB inflate budget. Tests reset the speed limiter and config between runs.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import socket
|
||||
import socketserver
|
||||
from pathlib import Path
|
||||
@@ -14,6 +15,8 @@ from unshackle.core.config import config
|
||||
from unshackle.core.proxies.proxy import CATALOGUES
|
||||
from unshackle.core.update_checker import UpdateChecker
|
||||
|
||||
requests_downloader = importlib.import_module("unshackle.core.downloaders.requests")
|
||||
|
||||
# shutdown() blocks until the serve loop polls again, and the 0.5s default is paid by every
|
||||
# test server at teardown. The default changes for the whole process, servers in core included.
|
||||
socketserver.BaseServer.serve_forever.__defaults__ = (0.01,)
|
||||
@@ -59,6 +62,13 @@ def default_codec_names(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(config, "codec_names", {})
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def no_speed_limit(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Start with no speed limit, so a limit that an earlier test locked cannot block a later one."""
|
||||
monkeypatch.setattr(requests_downloader, "speed_limiter", None)
|
||||
monkeypatch.setattr(requests_downloader, "speed_limit_locked", False)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mux_args(monkeypatch: pytest.MonkeyPatch) -> Callable[..., list[str]]:
|
||||
"""Run Tracks.mux up to mkvmerge and return its arguments; ``ids`` is what the track ID probe reports."""
|
||||
|
||||
Reference in New Issue
Block a user