[Distutils] Where should I put tests when packaging python modules?

Ionel Cristian Mărieș contact at ionelmc.ro
Wed Oct 7 13:58:06 CEST 2015


On Wed, Oct 7, 2015 at 8:12 AM, Thomas Güttler <guettliml at thomas-guettler.de
> wrote:

> I thought "easy_install" is a very old and deprecated method.
>

​Indeed it is. That why people put all sorts of custom "test" commands in
their setup.py to work around the deficiencies of the "test​
​" command setuptools provides.​ So we end up with lots of variations of
"how to use pytest to run tests via `setup.py test`", "how to use pip to
install deps, instead of what `setup.py test` normally does" and so on.

If you're gonna implement a test runner in your setup.py you might as well
use a supported and well maintained tool: tox.


> Why not use `setup.py test`?
>

​Because:

1. There's Tox​, which does exactly that, and more. It's maintained. It
gets features.
2. The "test" command will install the "test_requires" dependencies as
eggs. You will end up with multiple versions of the same eggs right in your
source checkout.
3. The "test" command will install the "test_requires" dependencies with
easy_install. That means wheels cannot be used.
4. Because the builtin "test" command is so bare people tend to implement a
custom one. Everyone does something slightly different, and slightly buggy.
5. There's no established tooling that relies on `setup.py test`. There
isn't even a test result protocol like TAP [1] for it. Why use something so
limited and outdated if there's no practical advantage?

[1] https://testanything.org/

Thanks,
-- Ionel Cristian Mărieș, http://blog.ionelmc.ro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20151007/b5781a8e/attachment.html>


More information about the Distutils-SIG mailing list