目录结构
├── aiosqlite3
│ ├── connection.py
│ ├── cursor.py
│ ├── __init__.py
│ ├── log.py
│ ├── pool.py
│ └── utils.py
├── LICENSE
├── makefile
├── Pipfile
├── Pipfile.lock
├── README.md
├── setup.py
└── tests
├── conftest.py
└── test_connect.py
conftest.py 里引入了上一层的
import aiosqlite3
然后执行py.test -s ./tests/
发生
ModuleNotFoundError: No module named 'aiosqlite3'
ERROR: could not load ${HOME}/project/aiosqlite3/tests/conftest.py
有点蒙蔽看aiomysql怎么都没问题
现在的方案是在
test/conftest.py 导入其它模块前
不知道为什么
pytest
只把项目下的 tests 文件夹加入了 sys.path,而项目文件夹没有加入。2018-05-02:
找到原因了,是
tests
目录下的__init__.py
写成了__init_.py
然后
pytest
只能以tests
为__main__