Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typical folder structure for a python project with unit and integration tests?

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
like image 717
p3t3 Avatar asked Nov 03 '22 22:11

p3t3


1 Answers

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.

like image 114
Joshua Howard Avatar answered Nov 15 '22 04:11

Joshua Howard