[packages/python3-pytest-examples] - new

qboosh qboosh at pld-linux.org
Fri Jul 11 17:14:24 CEST 2025


commit 316f2368b7edfe050e3f300b55473f3f6e99c687
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Jul 11 17:15:53 2025 +0200

    - new

 python3-pytest-examples.spec | 86 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
---
diff --git a/python3-pytest-examples.spec b/python3-pytest-examples.spec
new file mode 100644
index 0000000..e99eb7c
--- /dev/null
+++ b/python3-pytest-examples.spec
@@ -0,0 +1,86 @@
+#
+# Conditional build:
+%bcond_with	tests	# unit tests (TODO: dependencies)
+
+Summary:	Pytest plugin for testing examples in docstrings and markdown files
+Summary(pl.UTF-8):	Wtyczka pytesta do testowania przykładów w docstringach i plikach markdown
+Name:		python3-pytest-examples
+Version:	0.0.18
+Release:	1
+License:	MIT
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/pytest-examples/
+Source0:	https://files.pythonhosted.org/packages/source/p/pytest-examples/pytest_examples-%{version}.tar.gz
+# Source0-md5:	f943223d7da389e68e03265a270edef3
+URL:		https://pypi.org/project/pytest-examples/
+BuildRequires:	python3-build
+BuildRequires:	python3-hatchling
+BuildRequires:	python3-installer
+BuildRequires:	python3-modules >= 1:3.8
+%if %{with tests}
+BuildRequires:	python3-black >= 23
+BuildRequires:	python3-pytest >= 7
+BuildRequires:	python3-pytest-pretty >= 1.2.0
+BuildRequires:	python3-ruff >= 0.5.0
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 2.044
+Requires:	python3-modules >= 1:3.8
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Pytest plugin for testing Python code examples in docstrings and
+markdown files.
+
+It 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.
+
+%description -l pl.UTF-8
+Wtyczka pytesta do testowania przykładów kodu w Pythonie w
+docstringach oraz plikach markdown.
+
+Potrafi:
+- sprawdzać styl przykładów kodu przy użyciu ruffa i blacka
+- uruchamiać przykłady kodu
+- uruchamiać przykłady kodu i sprawdzać, czy instrukcje print są
+  osadzone poprawnie w kodzie
+
+Portrafi także uaktualniać w miejscu przykłady kodu, aby je
+sformatować i wstawiać lub uaktualniać instrukcje print.
+
+%prep
+%setup -q -n pytest_examples-%{version}
+
+%build
+%py3_build_pyproject
+
+%if %{with tests}
+# plugin requires module metadata, so need to extract wheel
+%{__python3} -m zipfile -e build-3/*.whl build-3-test
+
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTEST_PLUGINS=pytest_examples,pytest_pretty \
+PYTHONPATH=$(pwd)/build-3-test \
+%{__python3} -m pytest tests
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%py3_install_pyproject
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%{py3_sitescriptdir}/pytest_examples
+%{py3_sitescriptdir}/pytest_examples-%{version}.dist-info
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python3-pytest-examples.git/commitdiff/316f2368b7edfe050e3f300b55473f3f6e99c687



More information about the pld-cvs-commit mailing list