我想执行此导入:
from tests.db.connection_tests import ConnectionTests
其中tests包含名为db。的模块。
我收到ImportError: No module named 'tests.db'
。
测试结构如下:
tests
|
db
|
connection_tests.py
|
moduleA
问题似乎是Python已经有一个名为tests的模块。我想到的唯一选择是重命名测试模块。
答案 0 :(得分:0)
尝试将PYTHONPATH
env变量设置为test文件夹的路径。