Run the core tests from the gate and finish the layout rename
The gate now runs pytest as well, so one command answers whether the code base is broken: syntax, protocol imports, the 125 core tests, then the lab functional suites. It fails when a test fails, verified by feeding it a deliberately broken test. Two leftovers from moving the labs into experiments/ are fixed: the lab command still pointed at tests/, and the hook only watched protocol and tests, so edits under experiments/ and tools/ triggered nothing. Profiling the 3.6 s gate: 0.24 s syntax, 0.12 s imports, 0.61 s pytest, 2.7 s lab functional suites, of which Lab042's software loopback is 1.14 s because it pushes a whole image through the chain. The pytest addition is the small part. prepare_jpeg is now cached, since six checks call it and each call re-encoded the image at several qualities. README described the gate without the tests it now runs.
This commit is contained in:
@@ -26,6 +26,7 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import csv
|
||||
import functools
|
||||
import io
|
||||
import time
|
||||
from dataclasses import asdict, dataclass, field
|
||||
@@ -193,6 +194,7 @@ class FunctionalTestResult:
|
||||
# ==================================================================== подготовка
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=4)
|
||||
def prepare_jpeg(
|
||||
source_path: Path = SOURCE_IMAGE,
|
||||
width: int = IMAGE_WIDTH,
|
||||
@@ -207,6 +209,10 @@ def prepare_jpeg(
|
||||
заранее принятым значением, и возвращается вместе с байтами.
|
||||
|
||||
Возвращает готовые байты JPEG в градациях серого и применённое качество.
|
||||
|
||||
Результат кэшируется: функция вызывается шестью функциональными
|
||||
проверками подряд, а каждый вызов заново кодирует изображение в
|
||||
нескольких вариантах качества.
|
||||
"""
|
||||
|
||||
if not source_path.exists():
|
||||
|
||||
Reference in New Issue
Block a user