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

boB Stepp robertvstepp at gmail.com
Sun Aug 16 04:10:01 CEST 2015

In this Montessori Classroom Project (mcm) I am working on, I hope to
incorporate as much of the advice I've gotten here as I can remember.
So I want to do version control, TDD, etc., and do it as well as I
can.  Especially since this thing looks to grow considerably over
time.  I have not ever thought about formal project directory
structures before, so I may need a bit of guidance here.

My current skeleton structure is:


My intent is to use main.py to start the program.  I know I am going
to be using a database and a user interface, thus their folders.  I
don't yet have a feeling for how many additional directories I might
have for the bulk of the program logic code.

Right now I am trying to figure out how to arrange my unit test
file(s).  My initial thoughts are to have a single test directory with
separate subdirectories corresponding to each folder which has source
code.  Is this a good way to do things?

While searching through the Tutor archives I found one of Steve's
answers on project structure, which I copied part of below.
Unfortunately it did not address testing organization:

Re: [Tutor] Project directory structure
Steven D'Aprano Thu, 30 Jan 2014 03:26:22 -0800

If you're creating something a little more formal, say you plan to make
it public, there is a convention for laying out project directories:

+-- CHANGES.txt
+-- LICENCE.txt
+-- README.txt
+-- setup.py
+-- src
    +-- myproject.py

although the src directory is not compulsory.

If you're creating a package, rather than a single module, then you do
need to use a special directory structure:

+-- __init__.py
+-- __main__.py
+-- cheese.py
+-- eggs.py
+-- spam.py

It looks like I ought to combine the myproject and mypackage
recommendations into a coherent whole.  It looks like my current
subfolders of /db and /ui as well as main.py should go under the
subfolder /src.  The suggested files CHANGES.txt, LICENSE.txt, and
README.txt look like good things to include.  I don't know yet what
MANIFEST.in is about.  Makes me think of a shipping manifest, but that
is probably not its function.  And I don't know what set-up needs
setup.py would typically serve.  I will have to search for answers to

Does this cover everything I need to be concerned about as far as
project organization so that I do not run into future problems?



More information about the Tutor mailing list