[Tutor] Where should unit test files go in a project directory structure and some related questions?
Alan Gauld
alan.gauld at btinternet.com
Sun Aug 16 19:45:31 CEST 2015
On 16/08/15 16:41, Alex Kleider wrote:
>> - 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?
Thee are several options.
1) create links from, main to the test files needed
2) alter sys.path so imports can see the test folder
3) alter the PYTHONPATH environment var
But in most of my Python projects main is a file rather than
a folder so test is "under" main anyway. This above is a generic
structure because most of my projects use 4 or 5 languages
at least. Some IDEs require different structures too so the
separate lang sub-structures may vary to suit the toolset usee.
> I've not been able to do that. Is there a way?
I suspect in this case the easiest solution is a link
(aka shortcut in windoze)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list