[TIP] Advice on location of tests modules
olemis at gmail.com
Fri Feb 28 13:31:58 PST 2014
On Thu, Feb 27, 2014 at 5:37 PM, Barry Warsaw <barry at python.org> wrote:
> On Feb 27, 2014, at 04:43 PM, Olemis Lang wrote:
> >Recently a discussion has started about the location of test modules
> >developed for Apache Bloodhound _ .
> Paraphrasing the old joke, if you ask 5 Python programmers you'll get 10
> opinions. :)
yes , I know ... that's exactly one of the reasons why I started this
thread , just to explore other people's ideas .
> In my capacity as Debian and Ubuntu developer, I've certainly seen at least
> all three of your variations in packages I've looked at. For my own
> I strongly prefer:
> > 1. Our modified copy of Trac includes multiple test modules
> > i.e. one source code per-package all over across the whole hierarchy
> I put a tests subpackage and a docs subpackage right under the subpackage
> they are testing (or documenting <wink>). I do it this way, especially for
> big source trees like Mailman because I want the tests and docs to be as
> to the code as possible. It makes it *way* easier to find the test for a
> specific module.
makes sense to me with unit tests only ...
> >I'd rather prefer the option (3) because of the reasons I mentioned in
> >bh:comment:3:ticket:770 _ which I repeat below :
> > - Having a single top-level tests module (as opposite to Trac's
> > scattered test modules)
> > is convenient considering the package test discovery code
> I've gravitated toward nose2 for all my packages, and it has no problem
> layout #1.
... but #1 seems more complicated when dealing with functional tests
considering modules import-ed along the way .
> > - For code with functional + unit tests (i.e. quite often) I prefer to
> > write tests in a separate package hierarchy because :
> > * they should not be installed in production deployments
> I personally don't care much about that. I think it doesn't harm anything
> have the tests installed, and might even be useful for debugging. But I'm
> philosophically opposed to omitting the tests from production code, and in
> some of the Debian packaging I've done, we relegate such test directories
> to a
> "-dev" package.
Good point . However the Debian packaging system can do a number of install
operations not available (afaik) in distutils / setuptools / distribute /
pip ... package management ecosystem .
Olemis - @olemislc
Apache(tm) Bloodhound contributor
Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python