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

Felix Yan felixonmars at archlinux.org
Wed Apr 18 15:19:33 UTC 2018


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.

-- 
Regards,
Felix Yan

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


More information about the arch-dev-public mailing list