[Python-ideas] Official site-packages/test directory
Wolfgang Maier
wolfgang.maier at biologie.uni-freiburg.de
Fri Jan 19 11:30:56 EST 2018
On 01/19/2018 03:27 PM, Stefan Krah wrote:
>
> Hello,
>
> I wonder if we could get an official site-packages/test directory. Currently
> it seems to be problematic to distribute tests if they are outside the package
> directory. Here is a nice overview of the two main layout possibilities:
>
> http://pytest.readthedocs.io/en/reorganize-docs/new-docs/user/directory_structure.html
>
>
> I like the outside-the-package approach, mostly for reasons described very
> eloquently here:
>
> http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html
>
>
> CPython itself of course also uses Lib/foo.py and Lib/test/test_foo.py, so it
> would make sense to have site-packages/foo.py and site-packages/test/test_foo.py.
>
> For me, this is the natural layout.
>
I think that's a really nice idea.
With an official site-packages/test directory there could be pip support
for optionally installing tests alongside a package if its layout allows
it. So end users could just install things without tests, but developers
could do: pip install <package> --with-tests or something to get everything?
Wolfgang
More information about the Python-ideas
mailing list