Running pybuild tests with search path for entry_points()
(Please CC me as I'm not subscribed to debian-devel)
Hello,
I am currently trying to update src:kiwi to its latest upstream version to fix
#1069389 [1].
The problem that I am now stuck with is that the testsuite uses the entry_points
class to test for the available kiwi.tasks. It looks like something like this:
from importlib_metadata import entry_points
for entry in dict.get(entry_points(), 'kiwi.tasks'):
discovered_tasks[entry.name] = entry.load()
However, that fails because the kiwi module needs to be either installed for
entry_points() to find "kiwi.tasks" or the PYTHONPATH needs to include the
build directory below ".pybuild". Otherwise, entry_points() will not include
"kiwi.tasks" and the testsuite fails.
I noticed that entry_points() will also work as expected if the python interpretor
is run from within the build directory below ".pybuild", so I tried adding the
following to debian/rules according to [2]:
export PYTHONPATH = $(CURDIR)
export PYBUILD_TEST_ARGS_python3 = cd {build_dir}; python{version} -m discover
That doesn't work unfortunately and entry_points() still fails and there doesn't
seem to be much documentation available for pybuild which explains how to adjust
PYTHONPATH for running the testuite.
Note that I tried this with kiwi 10.0.16 plus the patch from [3]. I put up a little
reproducer in [4].
Does anyone know how to make pybuild set the proper PYTHONPATH so that entry_points()
works while running the testsuite?
Thanks,
Adrian
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1069389
> [2] https://wiki.debian.org/Python/Pybuild
> [3] https://github.com/OSInside/kiwi/pull/2550
> [4] https://github.com/OSInside/kiwi/issues/2548#issuecomment-2103993758
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Reply to: