1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-29 05:30:32 +02:00

build-system: pyproject: Add arguments to pytest_guix plugin.

* guix/build/pyproject-build-system.scm
(keywords->alist, guile->python-keywords): Add procedures.
(check): Convert keyword alist before writing it.

* guix/build-system/pyproject.scm (%default-pytest-guix-options):
Add some python kwargs in a guile format.

* gnu/packages/aux-files/python/pytest_guix.py
(pytest_addoption): Handle python kwargs when some are provided.

Change-Id: Ie35e9b300acda830f35b6b754e8ccc07ad730faa
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Nicolas Graves
2026-03-17 12:07:55 +01:00
committed by Sharlatan Hellseher
parent 16342836d1
commit 39a8dbbd6c
3 changed files with 67 additions and 20 deletions

View File

@@ -31,6 +31,12 @@ def pytest_addoption(parser):
otherwise, --cov is ignored (read by this parser, but nothing is done
with it).
Flags can be given with additional keyword arguments in a json object.
If the json object is not given, fallback to the default
{"action": "append", "nargs": "?"}. In practice, these arguments are only
mandatory for the store_true and store_const actions to avoid eating other
arguments.
This allows to remove development packages, which are not required at build
time while at the same time avoiding the need to adjust test options in
pyproject.toml or other configuration files.
@@ -45,5 +51,8 @@ def pytest_addoption(parser):
for key, options in plugin_options.items():
if importlib.util.find_spec(f"pytest_{key}") is None:
# Plugin not found, add stub options
for option in options:
group.addoption(option, action="append", nargs="?")
for option, kwargs in options.items():
if kwargs:
group.addoption(option, **kwargs)
else:
group.addoption(option, action="append", nargs="?")