[TIP] Fwd: Advice on location of tests modules
gokoproject at gmail.com
Thu Feb 27 16:30:22 PST 2014
On Thu, Feb 27, 2014 at 6:51 PM, Olemis Lang <olemis at gmail.com> wrote
> The structure is like this
> + /trunk
> | +-- bloodhound_dashboard
> | | +-- setup.py
> | | +-- bhdashboard
> | | +-- ... plugin source code with sub packages ...
> | | +-- tests
> | | +--- ... test code ...
>> I believe this means tests is also included in the package installation
>> (when you run setup.py)
> no, afaict those folders are ignored in setup.py pkg defintion . For
> multiproduct module the separation is more obvious . Harder to see for trac
> source tree .
I know this is not the right place to discuss this, but are you sure? I
just cloned and did a test.
>>> from bhdashboard.tests import test_report
In fact, bloodhound_multiproduct is the only package that has tests/ next
to setup.py. I think all the points you in comment 3 (
https://issues.apache.org/bloodhound/ticket/770#comment:3) are valid.
To back up your argument: see
http://www.ianbicking.org/docs/setuptools-presentation/ slide 20 though.
But sadly, a lot of projects choose to put tests as a subpackage. i suspect
this surprising outcome has to do with
For example, Pyramid does it:
Django webframework users also tend to write tests under each app.
So why would anyone choose to make tests a subpackage?
setuptools provides another command called tests (python setup.py tests).
I can even hook this up with nose and pytest. Therefore, people who choose
to make tests a submodule can separate test dependencies from project
dependencies. That's probably the #1 defense.
Ultimately, it's down to the core developers to side with you or not. I
think it makes sense NOT to ship tests during runtime. I don't know why I
would ever want to open my interpreter and knowing I could import
package.tests. That doesn't makes sense. I am not sure if there is a way to
tell setuptools don't make X directory a subpackage or not. Probably there
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python