Thanks Ori. You're right about the importing problem, I didn't think about that, so I'll use a suffix of "_test.py" instead.
On Tue, Sep 7, 2010 at 10:31 AM, Ori Peleg <[email protected]> wrote: > In my experience both solutions work. I've heard and read considerable > debate about the two approaches but it tends to boils down to non-technical > issues. > In your case, having the tests next to the modules sounds very convenient. > A dot in the filename can be tricky (importing, for example) but a > different suffix or prefix should be fine. > Another layout, which works better with a flatter directory tree than > yours, is to have a 'tests/' subdirectory in each package. > > On Tue, Sep 7, 2010 at 12:28 AM, cool-RR <[email protected]> wrote: > >> 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. >> >> _______________________________________________ >> Python-il mailing list >> [email protected] >> http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il >> >> > > > -- > Check out my blog: http://orip.org > -- Sincerely, Ram Rachum
_______________________________________________ Python-il mailing list [email protected] http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
