Reputation: 26467
The main question is: shall I include test suites for my code within the package or not? I do not mean neither a testing framework nor testing tools (such as nosetests) but the basic tests I run each time to check correctness of my code.
I've been following setuptools tutorial and I have two modules: nac (the code itself) and tests
. setup.py
looks like the following:
setup(
...
packages = ['nac', 'tests'],
...
)
And that's how it is installed in /usr/local/lib/python2.7/dist-packages/
:
dist-packages/
nac/
tests/
I'm pretty sure that what I have now is not the ultimate solution, since tests
package refers to nac
package - but you can'f figure it out just by looking at dist-packages
directory. I was thinking of creating one big nac
module with 2 submodules: core
and tests
. Is it a good approach? Is there a standard pythonic way to solve this issue?
Upvotes: 3
Views: 555
Reputation: 1404
Better put the test cases underneath the main package, i.e. nac.tests
. The test cases can use absolute import to load the main nac
package.
nac-project/
nac/
tests/
setup.py
In this way, you can run test cases against either 1) the local version, or 2) the deployed version of the nac
package.
Upvotes: 4