具有单元和集成测试的python项目的典型文件夹结构?

时间:2013-05-02 05:54:59

标签: python unit-testing

使用的典型结构和路径/导入约定是什么?有人可以链接到代表性的python项目吗?

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

2 个答案:

答案 0 :(得分:3)

与您所示的类似,典型的python项目结构如下。

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

```

这种说法很大程度上归功于个人经验,但它也是所倡导的结构here

我还看到integration_tests目录作为tests目录的兄弟,但我相信这不太常见。

与Bhavish Agarwal的回答相反,我没有提到Django的集成测试(仅使用Django进行集成测试)。他们似乎决定不再拥有任何东西。

答案 1 :(得分:-1)

既然你要求一个典型的结构,为什么看起来比(可以说)最着名的python框架更进一步:django

相关问题