[arch-dev-public] Unit tests for python packages

Morten Linderud foxboron at archlinux.org
Wed Apr 18 15:47:55 UTC 2018

On Wed, Apr 18, 2018 at 11:19:33PM +0800, Felix Yan via arch-dev-public wrote:
> For testing with not installed python modules, invoking setup.py
> commands are often preferable and addresses both PYTHONPATH and 2to3.
> For nosetests: Use "python setup.py nosetests" instead.
> For pytest: Use "python setup.py pytest" instead. Note that
> "python-pytest-runner" needs to be in checkdepends.
> There are additional common hacks if the tests need to invoke an entry
> points or requires the versioned distribution object. Either:
> 1) Installing it in a temporary place and hack PYTHONPATH/PATH.
> 2) Create a sitecustomize.py and add the build dir to site. (See
> python2-faulthandler for an example)
> And finally if above still didn't solve it, you may choose to skip the
> problematic part of the tests or use "heavier" workarounds like a venv.

I think we should be better at documenting these things. This is super usefull
to know about and not something that is obvious to everyone. I'll work on the
package guideline pages for Python and Golang whenever I have some spare
energy left and will be sure to include this.

Morten Linderud

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.archlinux.org/pipermail/arch-dev-public/attachments/20180418/08b063e4/attachment.asc>

More information about the arch-dev-public mailing list