diff --git a/devel/py-caio/Makefile b/devel/py-caio/Makefile index e5179b85575a..a76f00fc0ad9 100644 --- a/devel/py-caio/Makefile +++ b/devel/py-caio/Makefile @@ -1,22 +1,34 @@ PORTNAME= caio -PORTVERSION= 0.9.25 +PORTVERSION= 0.10.2 CATEGORIES= devel python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= yuri@FreeBSD.org COMMENT= Asynchronous file IO for Python WWW= https://github.com/mosquito/caio/ LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/COPYING BUILD_DEPENDS= ${PY_SETUPTOOLS} \ ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}anyio>0:devel/py-anyio@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}aiomisc-pytest>0:devel/py-aiomisc-pytest@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pytest-asyncio>0:devel/py-pytest-asyncio@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}pytest-timeout>0:devel/py-pytest-timeout@${PY_FLAVOR} USES= python -USE_PYTHON= pep517 autoplist +USE_PYTHON= pep517 autoplist pytest NO_ARCH= yes +post-extract: # is this really needed? + ${CP} ${FILESDIR}/conftest.py ${WRKSRC}/tests/conftest.py + +TEST_ENV= ${MAKE_ENV} +TEST_ARGS= --asyncio-mode=auto -p no:aiomisc -p no:relaxed # aiomisc-based tests fail, see https://github.com/mosquito/caio/issues/67 + +# tests as of 0.10.2: 6 passed in 0.60s + .include diff --git a/devel/py-caio/distinfo b/devel/py-caio/distinfo index c0dbdcc91a2e..0587badac15c 100644 --- a/devel/py-caio/distinfo +++ b/devel/py-caio/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1771915668 -SHA256 (caio-0.9.25.tar.gz) = 16498e7f81d1d0f5a4c0ad3f2540e65fe25691376e0a5bd367f558067113ed10 -SIZE (caio-0.9.25.tar.gz) = 26781 +TIMESTAMP = 1785390585 +SHA256 (caio-0.10.2.tar.gz) = 83b86d3c211ac585b979494848283443f3169d04ea9a0310dec2c9d577a1fba6 +SIZE (caio-0.10.2.tar.gz) = 35620 diff --git a/devel/py-caio/files/conftest.py b/devel/py-caio/files/conftest.py new file mode 100644 index 000000000000..9d17e73cdd27 --- /dev/null +++ b/devel/py-caio/files/conftest.py @@ -0,0 +1,29 @@ +import pytest +import caio + + +@pytest.fixture +def context_maker(): + """Create caio.Context instances""" + def maker(max_events=0): + return caio.Context(max_events) + return maker + + +@pytest.fixture +def async_context_maker(): + """Create async caio.AsyncioContext instances""" + def maker(max_events=0): + return caio.AsyncioContext(max_events) + return maker + + +@pytest.fixture +def asyncio_exception_handler(): + """Handle asyncio exceptions""" + exceptions = [] + + def handler(loop, context): + exceptions.append(context) + + return handler diff --git a/devel/py-caio/files/patch-pyproject.toml b/devel/py-caio/files/patch-pyproject.toml index 70c78c61888c..4e71e666ba4d 100644 --- a/devel/py-caio/files/patch-pyproject.toml +++ b/devel/py-caio/files/patch-pyproject.toml @@ -1,14 +1,16 @@ ---- pyproject.toml.orig 2026-02-24 06:48:06 UTC +--- pyproject.toml.orig 2026-07-05 10:25:07 UTC +++ pyproject.toml -@@ -1,10 +1,9 @@ +@@ -1,12 +1,10 @@ [build-system] -requires = ["setuptools>=77"] +requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "caio" + version = "0.10.2" +-license = "Apache-2.0" -license-files = ["COPYING"] description = "Asynchronous file IO for Linux MacOS or Windows." readme = "README.md" authors = [{ name = "Dmitry Orlov", email = "me@mosquito.su"}] diff --git a/devel/py-caio/files/patch-tests_test__asyncio__adapter.py b/devel/py-caio/files/patch-tests_test__asyncio__adapter.py new file mode 100644 index 000000000000..c66b91422308 --- /dev/null +++ b/devel/py-caio/files/patch-tests_test__asyncio__adapter.py @@ -0,0 +1,37 @@ +-- Replace aiomisc.timeout with pytest.mark.timeout +-- Tests require aiomisc-pytest which is not available as a FreeBSD port +-- This patch removes the aiomisc dependency and uses pytest.mark.timeout instead + +--- tests/test_asyncio_adapter.py.orig 2026-02-24 06:48:06 UTC ++++ tests/test_asyncio_adapter.py +@@ -3,11 +3,10 @@ + import os + from unittest.mock import Mock + +-import aiomisc + import pytest + + +-@aiomisc.timeout(5) ++@pytest.mark.timeout(5) + async def test_adapter(tmp_path, async_context_maker): + async with async_context_maker() as context: + with open(str(tmp_path / "temp.bin"), "wb+") as fp: +@@ -38,7 +37,7 @@ + assert hashlib.md5(bytes(data)).hexdigest() == expected_hash + + +-@aiomisc.timeout(3) ++@pytest.mark.timeout(3) + async def test_bad_file_descritor(tmp_path, async_context_maker): + async with async_context_maker() as context: + with open(str(tmp_path / "temp.bin"), "wb+") as fp: +@@ -63,7 +62,7 @@ + event_loop.set_exception_handler(current_handler) + + +-@aiomisc.timeout(3) ++@pytest.mark.timeout(3) + async def test_operations_cancel_cleanly( + tmp_path, async_context_maker, asyncio_exception_handler + ): diff --git a/devel/py-caio/pkg-descr b/devel/py-caio/pkg-descr index c066de3d9360..e1db57ebbf8d 100644 --- a/devel/py-caio/pkg-descr +++ b/devel/py-caio/pkg-descr @@ -1 +1,5 @@ -caio is Python bindings for AIO API and simple asyncio wrapper. +caio is a Python library providing asynchronous file I/O operations for Linux, +macOS, and Windows. It offers efficient asynchronous I/O through various backend +implementations and integrates with asyncio. The library provides both low-level +AIO API bindings and a high-level asyncio wrapper for convenient asynchronous +file operations.