On Thu, Oct 24, 2024 at 12:44:45PM +0200, John Paul Adrian Glaubitz wrote:
> (Please CC as I'm not subscribed to debian-devel)

(this is how I realized this is not debian-python@, consider using that
for more relevant coverage)

> I am maintaining the package src:kiwi [1] which hasn't been updated in
> Debian for some time since upstream has added tests that only work when
> the package source is installed into the test environment, i.e. available
> through PYTHONPATH.

I believe any or at least most Python unittests require the module being
tested to be available in sys.path and pybuild already helps with that, by
running tests in a directory with the package installed, is that not
enough? What are the specific problems you have?

> I have tried to adjust the environment variables in debian/rules as follows
> and tried to invoke the testsuite from the test/unit subdirectory:
> 
> export PYTHONPATH = $(CURDIR)

$(CURDIR) is already in sys.path when running python -m.

> export PYBUILD_TEST_ARGS_python3 = cd {build_dir}; python{version} -m discover
> 
> override_dh_auto_test:
> ifeq ($(filter nocheck nobench, $(DEB_BUILD_OPTIONS)),)
>         /bin/sh -c "cd test/unit && pytest-3"
You should use python* -m pytest (note that you need to run it for all
supported Python versions.

-- 
WBR, wRAR

Attachment: signature.asc
Description: PGP signature

Reply via email to