I haven't tried this in the rules file myself, but these commands
should work:
# python 3 LC_ALL=C.UTF-8 py.test-3 tests/
# python 2LC_ALL=C.UTF-8 py.test tests/
On Fri, 2018-01-12 at 14:18 -0500, Daniel Kahn Gillmor wrote:
> On Sun 2017-10-15 13:50:56 +0300, Adrian Bunk wrote:
> > ...
> > debian/rules override_dh_auto_test
> > make[1]: Entering directory '/build/1st/python-pgpy-0.4.3'
> > LC_ALL=C.UTF-8 dh_auto_test -O--buildsystem=pybuild
> > I: pybuild base:184: cd /build/1st/python-pgpy-
> > 0.4.3/.pybuild/pythonX.Y_3.5/build; python3.5 -m pytest tests
> > Traceback (most recent call last):
> > File "/usr/lib/python3/dist-packages/_pytest/config.py", line
> > 342, in _getconftestmodules
> > return self._path2confmods[path]
> > KeyError: local('/build/1st/python-pgpy-
> > 0.4.3/.pybuild/pythonX.Y_3.5/build/tests')
> >
> > During handling of the above exception, another exception occurred:
> > Traceback (most recent call last):
> > File "/usr/lib/python3/dist-packages/_pytest/config.py", line
> > 373, in _importconftest
> > return self._conftestpath2mod[conftestpath]
> > KeyError: local('/build/1st/python-pgpy-
> > 0.4.3/.pybuild/pythonX.Y_3.5/build/tests/conftest.py')
> >
> > During handling of the above exception, another exception occurred:
> > Traceback (most recent call last):
> > File "/usr/lib/python3/dist-packages/gpg/gpgme.py", line 14, in
> > swig_import_helper
> > return importlib.import_module(mname)
> > File "/usr/lib/python3.5/importlib/__init__.py", line 126, in
> > import_module
> > return _bootstrap._gcd_import(name[level:], package, level)
> > File "<frozen importlib._bootstrap>", line 985, in _gcd_import
> > File "<frozen importlib._bootstrap>", line 968, in _find_and_load
> > File "<frozen importlib._bootstrap>", line 955, in
> > _find_and_load_unlocked
> > ImportError: No module named 'gpg._gpgme'
> >
> > During handling of the above exception, another exception occurred:
> > Traceback (most recent call last):
> > File "/usr/lib/python3/dist-packages/_pytest/config.py", line
> > 379, in _importconftest
> > mod = conftestpath.pyimport()
> > File "/usr/lib/python3/dist-packages/py/_path/local.py", line
> > 662, in pyimport
> > __import__(modname)
> > File "/usr/lib/python3/dist-
> > packages/_pytest/assertion/rewrite.py", line 212, in load_module
> > py.builtin.exec_(co, mod.__dict__)
> > File "/build/1st/python-pgpy-
> > 0.4.3/.pybuild/pythonX.Y_3.5/build/tests/conftest.py", line 5, in
> > <module>
> > import gpg
> > File "/usr/lib/python3/dist-packages/gpg/__init__.py", line 101,
> > in <module>
> > from . import core
> > File "/usr/lib/python3/dist-packages/gpg/core.py", line 34, in
> > <module>
> > from . import gpgme
> > File "/usr/lib/python3/dist-packages/gpg/gpgme.py", line 17, in
> > <module>
> > _gpgme = swig_import_helper()
> > File "/usr/lib/python3/dist-packages/gpg/gpgme.py", line 16, in
> > swig_import_helper
> > return importlib.import_module('_gpgme')
> > File "/usr/lib/python3.5/importlib/__init__.py", line 126, in
> > import_module
> > return _bootstrap._gcd_import(name[level:], package, level)
> > ImportError: No module named '_gpgme'
> > ERROR: could not load /build/1st/python-pgpy-
> > 0.4.3/.pybuild/pythonX.Y_3.5/build/tests/conftest.py
> >
> > E: pybuild pybuild:283: test: plugin distutils failed with: exit
> > code=4: cd /build/1st/python-pgpy-
> > 0.4.3/.pybuild/pythonX.Y_3.5/build; python3.5 -m pytest tests
> > dh_auto_test: pybuild --test --test-pytest -i python{version} -p
> > "3.5 3.6" returned exit code 13
> > debian/rules:13: recipe for target 'override_dh_auto_test' failed
> > make[1]: *** [override_dh_auto_test] Error 25
> >
> > Either #866555 needs fixing or as workaround the tests
> > should run only with the default python3 version.
>
> this does indeed seem to be related to #866555, which doesn't seem
> like
> it will be fixed upstream, and i don't want to carry a diff for. so
> i
> suppose we should limit python-pgpy to only run the tests against
> the
> default python3 version. If there's a canonical way to do that, i'd
> be
> happy to see the pointers to it, otherwise i'll just blunder along
> and
> see what i can figure out.
>
> --dkg-- Michael Greene Software Engineer [email protected]
signature.asc
Description: This is a digitally signed message part

