Files
cuframes/python/tests/test_smoke.py
T
gx a7da4ea728 python: skeleton pybind11 bindings (issue #6 task #197)
Каркас 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>
2026-06-13 12:59:04 +01:00

52 lines
1.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""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)