[Tutor] Where should unit test files go in a project directory structure and some related questions?

Alex Kleider akleider at sonic.net
Sun Aug 16 17:41:45 CEST 2015


On 2015-08-16 01:28, Alan Gauld wrote:

> Here is my default structure
> 
> project
> - doc	project documents: contracts reqs, designs, test specs etc
> - man(*)   user docs
> - bin(*)   the master exe or main.py type files
> - lib(*)   the shipping libraries
> - src      the code
> -- lang      folder per language used - sql, python, C, bash, etc
> --- lib      modules/packages - subfolder per package
> --- test     test code - sub-tree under this, depends on test tools.
> --- tools    tools used but not shipped - db load/reset etc
> --- main     folder in some languages, a file in others

Alan,
Assuming the above structure and further assuming that your python test 
suite is under test,
how do you arrange to import code that is under main?
I have only been able to figure out how to import code that is at the 
same or lower level in the file structure.
If one's test code was in --- test/test.py, an import of --- main or 
main/mycode.py would have to 'find' the latter by traveling up the tree 
to test and then over to main, or over to main and then down to 
mycode.py.
I've not been able to do that.  Is there a way?
Alex


More information about the Tutor mailing list