Hi,

Yesterday I was packaging python-pywebpush[1]. To enable autopkgtest,
I used `Testsuite: autopkgtest-pkg-pybuild' in d/control. But when
autopkgtest stage, pytest didn't discover any tests. weepingclown and
I dug into the problem and found tests in pywebpush/tests are not
copied to the build directory; instead, pybuild only copies
pyproject.toml, pytest.ini, test, and tests directories. pybuild(1)
documented that "you can list them in debian/pybuild.testfiles file".

By creating d/pybuild.testfiles and adding "pywebpush/tests" to the
file, autopkgtest works. But reviewing the build log, we found all
tests are running twice in dh_auto_test. The log shows:

tests/test_webpush.py
pywebpush/tests/test_webpush.py

I asked on #debian-python IRC yesterday, and currently using `export
PYBUILD_TEST_ARGS=--ignore pywebpush/tests' to avoid being tested
twice. I also did some searching on codesearch.debian.net, and I found
that some other packages are either tested twice or doing similar
things to avoid being tested twice. Following are three attempts to
ensure tested only once:

src:isodate
    export PYBUILD_BEFORE_TEST=cp -r {dir}/tests {build_dir}/
    export PYBUILD_TEST_ARGS=tests/test_*.py

src:python-cymem
    export PYBUILD_NAME = cymem
    export PYBUILD_TEST_ARGS = tests

src:python-ewokscore
    ifeq ($(PYBUILD_AUTOPKGTEST),1)
    export PYBUILD_TEST_ARGS := {dir}/src/ewokscore
    endif

Are there better solutions to this problem?

[1]: https://salsa.debian.org/homeassistant-team/deps/python-pywebpush/

Best Regards,
Tianyu Chen

Reply via email to