Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #12911 > unrolled thread

dh_auto_test failure with pybuild due to missing PYTHONPATH

Started byFlorian Weimer <fw@deneb.enyo.de>
First post2020-10-04 10:30 +0200
Last post2020-10-04 20:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.debian.maint.python


Contents

  dh_auto_test failure with pybuild due to missing PYTHONPATH Florian Weimer <fw@deneb.enyo.de> - 2020-10-04 10:30 +0200
    Re: dh_auto_test failure with pybuild due to missing PYTHONPATH Louis-Philippe Véronneau <pollo@debian.org> - 2020-10-04 20:40 +0200

#12911 — dh_auto_test failure with pybuild due to missing PYTHONPATH

FromFlorian Weimer <fw@deneb.enyo.de>
Date2020-10-04 10:30 +0200
Subjectdh_auto_test failure with pybuild due to missing PYTHONPATH
Message-ID<AW7z3-3Ll-3@gated-at.bofh.it>
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.

[toc] | [next] | [standalone]


#12923

FromLouis-Philippe Véronneau <pollo@debian.org>
Date2020-10-04 20:40 +0200
Message-ID<AWh5n-1jn-1@gated-at.bofh.it>
In reply to#12911

[Multipart message — attachments visible in raw view] — view raw

On 2020-10-04 04 h 21, Florian Weimer wrote:
> 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?

You could use "export PYBUILD_BEFORE_TEST=PYTHONPATH=" to tell pybuild
to run a command before the testsuite is ran.

I'd consider that "cleaner" than overriding dh_auto_test.

> 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.

Not sure I understand what you mean by "against the installed binaries".
The testsuite ran during build isn't ran against installed binaries,
that's why we use autopkgtests.

Here is an example of an autopkgtest running the testsuite and exporting
a python path:

https://sources.debian.org/src/supysonic/0.6.0+ds-1/debian/tests/unittests/?hl=4#L4


-- 
  ⢀⣴⠾⠻⢶⣦⠀
  ⣾⠁⢠⠒⠀⣿⡁  Louis-Philippe Véronneau
  ⢿⡄⠘⠷⠚⠋   pollo@debian.org / veronneau.org
  ⠈⠳⣄

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.maint.python


csiph-web