[Python-il] Where to put tests

cool-RR cool-rr at cool-rr.com
Tue Sep 7 00:28:40 IDT 2010


Hello guys!

I'm still new to the whole testing thing. There's something that I've been
thinking about and maybe you'll have an idea.

For my project GarlicSim I created a few tests modules, which I put in a
"tests" directory alongside the "garlicsim" directory. This arrangement
works, but it kind of bothers me, because in `garlicsim` I have a deep tree
of packages; Python packages inside Python packages inside Python packages
etc.

What's bothering me is this: What happens if I want to write a test for a
module which is deep in the hierarchy of the project? I mean, I wouldn't
want to put all my tests in one directory, because there will be so many
tests, ideally one for each module, and I have ~300 modules. So I'll
probably want the tests to be arranged in a tree structure similar to the
code itself. But then I thought, why bother with a "tests" directory at all?
Maybe instead of a "tests" directory, I'll just put the test for each module
alongside that module? I figured maybe I can give the test modules names
that end in ".test.py" so it will be easy to tell the difference between
test modules and normal modules.

Do you think this solution can work? Any problems I didn't think about? Any
other ideas that might be helpful?


Best Wishes,
Ram.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://hamakor.org.il/pipermail/python-il/attachments/20100906/f117ab00/attachment.htm 


More information about the Python-il mailing list