test: delete slow, timing-based and redundant tests

This commit is contained in:
imSp4rky
2026-12-05 15:20:05 -07:00
parent 783a2fc185
commit 3a0a74e694
292 changed files with 153 additions and 15174 deletions
-64
View File
@@ -221,46 +221,6 @@ def test_permanent_status_unwraps_causes():
BIG = bytes((i * 13 + 7) % 256 for i in range(8 * 1024 * 1024))
class _BigHandler(BaseHTTPRequestHandler):
protocol_version = "HTTP/1.1"
def do_GET(self):
srv = self.server
rng = self.headers.get("Range")
with srv.lock:
srv.requests.append(rng)
if not rng:
self.send_response(200)
self.send_header("Content-Length", str(len(BIG)))
self.end_headers()
self.wfile.write(BIG)
return
start_s, _, end_s = rng.removeprefix("bytes=").partition("-")
start = int(start_s)
end = int(end_s) if end_s else len(BIG) - 1
body = BIG[start : end + 1]
self.send_response(206)
self.send_header("Content-Range", f"bytes {start}-{end}/{len(BIG)}")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def log_message(self, *args):
pass
@pytest.fixture
def big_server():
srv = ThreadingHTTPServer(("127.0.0.1", 0), _BigHandler)
srv.lock = threading.Lock()
srv.requests = []
thread = threading.Thread(target=srv.serve_forever, daemon=True)
thread.start()
yield srv
srv.shutdown()
thread.join(timeout=5)
_REAL_SPLIT = dl.split_ranges
@@ -291,32 +251,8 @@ def plan_split(monkeypatch, tmp_path, total_size, max_workers):
return record[0]
def test_part_count_matches_worker_count(tmp_path, monkeypatch):
_, _, _, parts = plan_split(monkeypatch, tmp_path, 64 * 1024 * 1024, 16)
assert len(parts) == 16
_, _, _, parts = plan_split(monkeypatch, tmp_path, 16 * 1024 * 1024, 4)
assert len(parts) == 4
def test_part_floor_caps_sliver_count(tmp_path, monkeypatch):
# below the 4 MiB floor a part's handshake costs more than its transfer
_, _, target, parts = plan_split(monkeypatch, tmp_path, 16 * 1024 * 1024, 64)
assert target == 4 * 1024 * 1024
assert len(parts) == 4
def test_worker_driven_parts_merge_byte_identical(big_server, tmp_path):
save_path = tmp_path / "big.bin"
for _ in dl.dispatch_parts(
url=url(big_server, "/big.bin"),
save_path=save_path,
session=Session(),
total_size=len(BIG),
max_workers=2,
):
pass
assert save_path.read_bytes() == BIG
assert len({r for r in big_server.requests if r}) == 2
assert not save_path.with_name(save_path.name + ".!dev").exists()