forked from kenzuya/unshackle
test: delete slow, timing-based and redundant tests
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import struct
|
||||
import threading
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from unshackle.core.utilities import get_boxes
|
||||
@@ -18,27 +17,3 @@ def test_get_boxes_finds_the_tenc() -> None:
|
||||
kid = uuid4()
|
||||
(box,) = get_boxes(tenc_init(kid, 1, 0x19), b"tenc")
|
||||
assert box.key_ID == kid
|
||||
|
||||
|
||||
def test_get_boxes_is_right_when_tracks_parse_at_the_same_time() -> None:
|
||||
cases = [(uuid4(), version, crypt_skip) for version, crypt_skip in ((0, 0), (1, 0x19), (1, 0x91), (1, 0x55))] * 2
|
||||
failures: list[str] = []
|
||||
|
||||
def parse(kid: UUID, version: int, crypt_skip: int) -> None:
|
||||
data = tenc_init(kid, version, crypt_skip)
|
||||
for _ in range(1500):
|
||||
try:
|
||||
boxes = list(get_boxes(data, b"tenc"))
|
||||
except Exception as e:
|
||||
failures.append(repr(e))
|
||||
continue
|
||||
if [box.key_ID for box in boxes] != [kid]:
|
||||
failures.append("wrong or missing tenc")
|
||||
|
||||
threads = [threading.Thread(target=parse, args=case) for case in cases]
|
||||
for thread in threads:
|
||||
thread.start()
|
||||
for thread in threads:
|
||||
thread.join(timeout=120)
|
||||
assert not failures, failures[:3]
|
||||
assert not any(thread.is_alive() for thread in threads)
|
||||
|
||||
Reference in New Issue
Block a user