a7da4ea728
Каркас Python-пакета `cuframes`: - python/pyproject.toml — scikit-build-core конфиг - python/CMakeLists.txt — pybind11 module через FetchContent - python/src/_native.cpp — module entry, error таксономия, enum mirrors (PixelFormat, SubscriberMode), version - python/cuframes/__init__.py — re-export публичного API - python/tests/test_smoke.py — smoke tests без real subscribe - python/README.md — статус + build instructions - CMakeLists.txt — подключение python/ при BUILD_PYTHON_BINDINGS=ON Реальный subscriber/frame wrapper в следующих коммитах (tasks #198-#202). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
"""Smoke tests для cuframes Python bindings.
|
||
|
||
В Phase 0 (skeleton) проверяем что:
|
||
- модуль импортируется
|
||
- версия читается
|
||
- error классы существуют и являются нормальной иерархией
|
||
|
||
Subscriber / DLPack тесты появятся в следующих фазах
|
||
(см. issue gx/cuframes#6, tasks #198+).
|
||
"""
|
||
|
||
import cuframes
|
||
|
||
|
||
def test_version_format():
|
||
v = cuframes.version_string()
|
||
assert isinstance(v, str)
|
||
parts = v.split(".")
|
||
assert len(parts) >= 3
|
||
assert all(p.isdigit() for p in parts[:3])
|
||
|
||
|
||
def test_protocol_version_is_uint():
|
||
pv = cuframes.protocol_version()
|
||
assert isinstance(pv, int)
|
||
assert pv >= 0
|
||
|
||
|
||
def test_pixel_format_enum_members():
|
||
assert cuframes.PixelFormat.NV12.value == 0
|
||
assert cuframes.PixelFormat.YUV420P.value == 1
|
||
|
||
|
||
def test_subscriber_mode_enum_members():
|
||
assert cuframes.SubscriberMode.NEWEST_ONLY.value == 0
|
||
assert cuframes.SubscriberMode.STRICT_ORDER.value == 1
|
||
|
||
|
||
def test_error_hierarchy():
|
||
"""Все subtype'ы наследуются от CuframesError."""
|
||
for sub in [
|
||
cuframes.CuframesPublisherGone,
|
||
cuframes.CuframesFrameTimeout,
|
||
cuframes.CuframesDeviceLost,
|
||
cuframes.CuframesShmError,
|
||
cuframes.CuframesProtocolMismatch,
|
||
cuframes.CuframesInvalidArgument,
|
||
cuframes.CuframesOutOfMemory,
|
||
cuframes.CuframesInternal,
|
||
]:
|
||
assert issubclass(sub, cuframes.CuframesError)
|