git: 2ab8dace2117 - main - devel/py-pytest-examples: New port: Py.test plugin for testing examples in docstrings and markdown files

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 28 Jul 2024 23:57:48 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2ab8dace211756aa2bbc643945d57df079ae6417

commit 2ab8dace211756aa2bbc643945d57df079ae6417
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-07-28 21:57:28 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-07-28 23:57:42 +0000

    devel/py-pytest-examples: New port: Py.test plugin for testing examples in docstrings and markdown files
---
 devel/Makefile                     |  1 +
 devel/py-pytest-examples/Makefile  | 30 ++++++++++++++++++++++++++++++
 devel/py-pytest-examples/distinfo  |  3 +++
 devel/py-pytest-examples/pkg-descr |  9 +++++++++
 4 files changed, 43 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 63b2df88c82c..8b4aaa47d538 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -5531,6 +5531,7 @@
     SUBDIR += py-pytest-drop-dup-tests
     SUBDIR += py-pytest-enabler
     SUBDIR += py-pytest-env
+    SUBDIR += py-pytest-examples
     SUBDIR += py-pytest-factoryboy
     SUBDIR += py-pytest-fixture-config
     SUBDIR += py-pytest-flake8
diff --git a/devel/py-pytest-examples/Makefile b/devel/py-pytest-examples/Makefile
new file mode 100644
index 000000000000..2223b075fce5
--- /dev/null
+++ b/devel/py-pytest-examples/Makefile
@@ -0,0 +1,30 @@
+PORTNAME=	pytest-examples
+DISTVERSION=	0.0.12
+CATEGORIES=	devel python
+MASTER_SITES=	PYPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+DISTNAME=	${PORTNAME:S/-/_/}-${DISTVERSION}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Py.test plugin for testing examples in docstrings and markdown files
+WWW=		https://github.com/pydantic/pytest-examples
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}hatchling>0:devel/py-hatchling@${PY_FLAVOR}
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}black>=23:devel/py-black@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest>=7:devel/py-pytest@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}ruff>=0.5.0:devel/py-ruff@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}coverage>=0:devel/py-coverage@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-pretty>0:devel/py-pytest-pretty@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}ruff>=0.5.0:devel/py-ruff@${PY_FLAVOR}
+
+USES=		python
+USE_PYTHON=	pep517 autoplist pytest
+
+TEST_ENV=	${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+
+NO_ARCH=	yes
+
+.include <bsd.port.mk>
diff --git a/devel/py-pytest-examples/distinfo b/devel/py-pytest-examples/distinfo
new file mode 100644
index 000000000000..71107ace10c7
--- /dev/null
+++ b/devel/py-pytest-examples/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1722196231
+SHA256 (pytest_examples-0.0.12.tar.gz) = 58da3a1d4d6b5efedbb1c0e4fc94472e44c6bb3e1e199822728d778d809c8ff7
+SIZE (pytest_examples-0.0.12.tar.gz) = 20429
diff --git a/devel/py-pytest-examples/pkg-descr b/devel/py-pytest-examples/pkg-descr
new file mode 100644
index 000000000000..77b674a1881c
--- /dev/null
+++ b/devel/py-pytest-examples/pkg-descr
@@ -0,0 +1,9 @@
+Pytest plugin for testing Python code examples in docstrings and markdown files.
+
+pytest-examples can:
+* lint code examples using ruff and black
+* run code examples
+* run code examples and check print statements are inlined correctly in the code
+
+It can also update code examples in place to format them and insert or update
+print statements.