style: tighten comments added on this branch

This commit is contained in:
imSp4rky
2026-08-07 11:43:13 -06:00
parent d16e8b32ee
commit 9466db37a6
6 changed files with 13 additions and 14 deletions
+1 -1
View File
@@ -151,6 +151,6 @@ def test_rnet_encoded_body_discards_a_partial_instead_of_range_resuming(tmp_path
save_path = tmp_path / "sub.vtt"
save_path.with_name("sub.vtt.!dev").write_bytes(PLAIN[:5000])
list(download(url="http://127.0.0.1:1/sub.vtt", save_path=save_path, session=session))
# the encoded 206 must be dropped (never appended); the restart fetches the whole body
# the encoded 206 must be dropped, not appended; the clean restart fetches the whole body
assert session.range_requests == 1
assert save_path.read_bytes() == PLAIN
+2 -3
View File
@@ -116,9 +116,8 @@ def test_range_item_ignored_by_server_fails_not_corrupts(server, tmp_path, monke
def test_range_item_spanning_whole_resource_accepts_200(server, tmp_path):
# RFC 9110 lets a server ignore Range and answer 200 with the whole resource; when
# the slice spans that whole resource the body is byte-identical to the 206, so it
# must be kept instead of burning five attempts and failing the track
# RFC 9110 lets a server ignore Range and answer 200 with the whole resource; when the
# slice spans that resource the body is byte-identical to the 206 and must be kept
server.honor_range = False
urls = [{"url": _url(server), "headers": {"Range": f"bytes=0-{len(PARENT) - 1}"}}]
files = _run(server, tmp_path, urls, max_workers=1)
+4 -4
View File
@@ -14,8 +14,8 @@ requests_downloader = importlib.import_module("unshackle.core.downloaders.reques
@pytest.fixture(autouse=True)
def _clean_cancel():
# a failing batch anywhere sets the process-global cancel, and TokenBucket.consume
# waits on it, so a leaked flag voids every timing assertion; keep tests independent
# a failing batch sets the process-global cancel, which TokenBucket.consume waits on;
# keep tests independent
DOWNLOAD_CANCELLED.clear()
yield
DOWNLOAD_CANCELLED.clear()
@@ -97,8 +97,8 @@ def test_bucket_holds_aggregate_rate_across_threads():
def test_bucket_chunk_larger_than_capacity_does_not_deadlock(monkeypatch):
# capture the debt sleep instead of racing the wall clock: Event.wait may wake
# early spuriously, which intermittently tripped a lower bound on real sleeps
# capture the debt sleep instead of timing it: Event.wait can wake early spuriously,
# so a wall-clock lower bound flakes
waits: list[float] = []
monkeypatch.setattr(requests_downloader, "DOWNLOAD_CANCELLED", SimpleNamespace(wait=waits.append))
bucket = TokenBucket(1_000_000)