From 656086e874ccb7d503f4e6ff797a2b11b09a1cb1 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Mar 30 2023 11:27:44 +0000 Subject: Document %{py3_test_envvars} --- diff --git a/guidelines/modules/ROOT/pages/Python.adoc b/guidelines/modules/ROOT/pages/Python.adoc index 945de27..28df2a6 100644 --- a/guidelines/modules/ROOT/pages/Python.adoc +++ b/guidelines/modules/ROOT/pages/Python.adoc @@ -1086,8 +1086,30 @@ appropriate for `+%check+`: * Locations in the buildroot are added to `+$PATH+` and `+$PYTHONPATH+`. * `+$PYTHONDONTWRITEBYTECODE+` is set to avoid writing pytest-specific cache files to buildroot +* `+$PYTEST_XDIST_AUTO_NUM_WORKERS+` is set to `+%{_smp_build_ncpus}+` * If unset, `+$CFLAGS+` and `+$LDFLAGS+` are set to match the build flags +==== Other test runners + +If upstream doesn’t use `+tox+` or `+pytest+`, +other test runners can be invoked with <> macro, +available since Fedora Linux 38. + +This macro sets several environment variables similarly to `+%pytest+`, +but requires the actual test runner to be invoked after the macro, for example: + +[source,spec] +---- +%{py3_test_envvars} %{python3} -m unittest +---- + +Or: + +[source,spec] +---- +%{py3_test_envvars} %{python3} tests/run_tests.py +---- + === Test dependencies One part of the Python packaging ecosystem that is still not standardized @@ -1563,6 +1585,14 @@ See <> for details. + The command that `+%pytest+` uses. May be redefined. +[#py3_test_envvars] +* `+%py3_test_envvars+` (`+PATH=... PYTHONPATH=... PYTHONDONTWRITEBYTECODE=1 ...+`) ++ +The environment variables used by `+%pytest+` and `+%tox+`. +It may be used to invoke custom test runners in `+%check+`. +See <> for details. +Introduced in Fedora Linux 38. + [#py3_check_import] * `+%py3_check_import+` +