[opensuse-packaging] Tests in python packages
Hi, I'm currently trying to package a python-lib which includes some c-code and face some issues for running the automatic tests. For normal packages, the test can be run quite simply. E.g. tests are in tests/, you add .. to the python path and then run nose or unittests. An ugly too, but it works. For compiled files I can't do this trick, because I need to get the compiled resources in site-packages. In chroot I can run this: PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python3-pyasn-1.5.0b7-0.x86_64/usr/lib64/python3.5/site-packages/ python3 -c "import pyasn.pyasn_radix" But I can't use this in the spec-file. I only get /home/abuild/rpmbuild/BUILDROOT/python3-pyasn-1.5.0b7-0.x86_64/ as %{buildroot}, but %{python_sitearch} seems to be empty. Do you have any hints how to accomplish this? The package in question: https://build.opensuse.org/package/show/home:sebix/python3-pyasn -- python programming - mail server - photo - video - https://sebix.at cryptographic key at https://sebix.at/DC9B463B.asc and on public keyservers
On 07/30/2016 08:14 AM, Sebastian wrote:
Hi,
I'm currently trying to package a python-lib which includes some c-code and face some issues for running the automatic tests.
For normal packages, the test can be run quite simply. E.g. tests are in tests/, you add .. to the python path and then run nose or unittests. An ugly too, but it works.
For normal packages, don't you just do something like python[3] setup.py test ?
For compiled files I can't do this trick, because I need to get the compiled resources in site-packages. In chroot I can run this: PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python3-pyasn-1.5.0b7-0.x86_64/usr/lib64/python3.5/site-packages/ python3 -c "import pyasn.pyasn_radix"
But I can't use this in the spec-file. I only get /home/abuild/rpmbuild/BUILDROOT/python3-pyasn-1.5.0b7-0.x86_64/ as %{buildroot}, but %{python_sitearch} seems to be empty. Do you have any hints how to accomplish this?
Well, since it is a Python 3 and not 2 package I believe the macro you are looking for is %{python3_sitearch}. I do not, however, understand what the problem is so I can't be of more help.
The package in question: https://build.opensuse.org/package/show/home:sebix/python3-pyasn
-- Jason Craig -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Hi, On 07/30/2016 06:57 PM, Jason Craig wrote:
On 07/30/2016 08:14 AM, Sebastian wrote:
Hi,
I'm currently trying to package a python-lib which includes some c-code and face some issues for running the automatic tests.
For normal packages, the test can be run quite simply. E.g. tests are in tests/, you add .. to the python path and then run nose or unittests. An ugly too, but it works.
For normal packages, don't you just do something like python[3] setup.py test ? Sometime the easiest solution is not so far. Thanks, for this package it works well. For packages not providing the test-command, one has to patch it in tough.
I documented it in the wiki too now: https://en.opensuse.org/openSUSE:Packaging_Python#Running_tests Sebastian -- python programming - mail server - photo - video - https://sebix.at cryptographic key at https://sebix.at/DC9B463B.asc and on public keyservers
participants (2)
-
Jason Craig
-
Sebastian