Is there a best practice for where tests should live in a Django project?
-
I am setting up a new project with Django - my first time. I have done much research on how to structure the project hierarchy and looked as several Django projects in github. I have come up with this structure (abbreviated) project |--api - apis go here - these are lower level apis to services |--search - search api |--nlp - nlp service api |--apps - Django apps go here |--app1 ... |--handlers - business layer apis - these can be called by apps |--templates http://fabfile.py http://wsgi.py http://settings.py ... Where should tests go? I want to have unit tests and integration tests separate. Should I create a test dir at the project level and follow the same source hierarchy... project ... |---test |---unit |---api |---serach |http://---sometest.py |---nlp |---apps |---app1 |http://---sometest.py |---handlers |http://---sometest.py |---integration |---api |---search |http://---someinttest.py etc. or should they live with the source... project api search http://somesrc.py test unit http://sometest.py integration http://someinttest.py etc. or is some other organization better?
-
Answer:
Put your tests in a tests directory within each app app/app1/tests/http://__init__.py app/app1/tests/http://test_cases_one.py app/app1/tests/http://test_cases_two.py if you want to group them all together, I recommend using a product like nose: http://nose.readthedocs.org/en/latest/
Joseph Misiti at Quora Visit the source
Related Q & A:
- What is the best practice for free space for a SQL server database drive?Best solution by Database Administrators
- How do you convert an Android project to a maven project manually?Best solution by Quora
- What is a website where there are live web shows?Best solution by Yahoo! Answers
- How to open a private practice?Best solution by Quora
- Where is the best area to live with a family Chester, UK?Best solution by mumsnet.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.