8

What would be a typical structure and path/import conventions used? Would anyone have a link to a representative python project?

project.scratch/
    project/
        scratch/
            __init__.py
            dostuff.py
            tests/
                unit/
                    test_dostuff.py
                integration/
                    test_integration.py
1

2 Answers 2

5

Similar to what you have shown, the typical python project structure is as follows.

├── app_name
    │
    ├── app_name
    │   ├── __init__.py
    │   ├── folder_name
    │   └── etc...
    ├── tests
    │   ├── unit
    │   └── integration
    ├── README.md
    ├── setup.py
    └── requirements.txt

```

This statement is largely due to personal experience, but it is also the structure advocated here.

I have also seen an integration_tests directory as a sibling of the tests directory instead, but I believe that this is much less common.

Contrary to Bhavish Agarwal's answer, I see no mention of integration tests for Django (only integration tests using Django). It seems they decided not to have any.

Sign up to request clarification or add additional context in comments.

4 Comments

I have also seen an integration_tests directory as a sibling of the tests directory instead, but I believe that this is much less common. -> So where would be the right place ? I currently have my structure similar to what you have described but im not sure if this is right? Or is there no right or wrong way
@Naveen There is no right or wrong way. I like the structure that I provided because pytest will run both unit and integration tests together with both in the tests folder. It's still just personal opinion.
Advocated link is broken @JoshuaHoward
Adding what I think is the correct link @JoshuaHoward advocated here: docs.saltproject.io/en/latest/topics/tutorials/…
-2

Since you asked for a typical structure, why look further than (arguably) the most famous python framework: django

2 Comments

Where can I find integration tests in django, and how would coverage tests be performed?
Please expand this answer with an actual structure, don't just link to somewhere else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.