dh_auto_test failure with pybuild due to missing PYTHONPATH
I'm trying to package git-pw, and running the test suite fails like
this:
dh_auto_test -O--buildsystem=pybuild
I: pybuild base:217: cd /build/git-pw-2.0.0/.pybuild/cpython3_3.8_git-pw/build; python3.8 -m pytest tests
=========================================== test session starts ===========================================
platform linux -- Python 3.8.6, pytest-4.6.11, py-1.9.0, pluggy-0.13.0
rootdir: /build/git-pw-2.0.0
collected 0 items / 5 errors
================================================= ERRORS ==================================================
__________________ ERROR collecting .pybuild/cpython3_3.8_git-pw/build/tests/test_api.py __________________
tests/test_api.py:6: in <module>
from git_pw import api
git_pw/__init__.py:8: in <module>
__version__ = pkg_resources.get_distribution('git-pw').version
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:480: in get_distribution
dist = get_provider(dist)
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:356: in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:899: in require
needed = self.resolve(parse_requirements(requirements))
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:785: in resolve
raise DistributionNotFound(req, requirers)
E pkg_resources.DistributionNotFound: The 'git-pw' distribution was not found and is required by the application
________________ ERROR collecting .pybuild/cpython3_3.8_git-pw/build/tests/test_bundle.py _________________
tests/test_bundle.py:7: in <module>
from git_pw import bundle
git_pw/__init__.py:8: in <module>
__version__ = pkg_resources.get_distribution('git-pw').version
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:480: in get_distribution
dist = get_provider(dist)
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:356: in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:899: in require
needed = self.resolve(parse_requirements(requirements))
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:785: in resolve
raise DistributionNotFound(req, requirers)
E pkg_resources.DistributionNotFound: The 'git-pw' distribution was not found and is required by the application
_________________ ERROR collecting .pybuild/cpython3_3.8_git-pw/build/tests/test_patch.py _________________
tests/test_patch.py:9: in <module>
from git_pw import patch
git_pw/__init__.py:8: in <module>
__version__ = pkg_resources.get_distribution('git-pw').version
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:480: in get_distribution
dist = get_provider(dist)
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:356: in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:899: in require
needed = self.resolve(parse_requirements(requirements))
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:785: in resolve
raise DistributionNotFound(req, requirers)
E pkg_resources.DistributionNotFound: The 'git-pw' distribution was not found and is required by the application
________________ ERROR collecting .pybuild/cpython3_3.8_git-pw/build/tests/test_series.py _________________
tests/test_series.py:7: in <module>
from git_pw import series
git_pw/__init__.py:8: in <module>
__version__ = pkg_resources.get_distribution('git-pw').version
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:480: in get_distribution
dist = get_provider(dist)
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:356: in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:899: in require
needed = self.resolve(parse_requirements(requirements))
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:785: in resolve
raise DistributionNotFound(req, requirers)
E pkg_resources.DistributionNotFound: The 'git-pw' distribution was not found and is required by the application
_________________ ERROR collecting .pybuild/cpython3_3.8_git-pw/build/tests/test_utils.py _________________
tests/test_utils.py:11: in <module>
from git_pw import utils
git_pw/__init__.py:8: in <module>
__version__ = pkg_resources.get_distribution('git-pw').version
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:480: in get_distribution
dist = get_provider(dist)
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:356: in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:899: in require
needed = self.resolve(parse_requirements(requirements))
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:785: in resolve
raise DistributionNotFound(req, requirers)
E pkg_resources.DistributionNotFound: The 'git-pw' distribution was not found and is required by the application
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================= 5 error in 0.40 seconds =========================================
E: pybuild pybuild:352: test: plugin distutils failed with: exit code=2: cd /build/git-pw-2.0.0/.pybuild/cpython3_3.8_git-pw/build; python3.8 -m pytest tests
dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.8 returned exit code 13
Apparently, the test suite expects PYTHONPATH to be set. Is there a
way to achieve this in a clean way?
Adding this to debian/rules works:
override_dh_auto_test:
PYTHONPATH=. pytest-3 tests
But it won't run the tests against the installed binaries.
Reply to: