ImportError没有名为tests

时间:2017-12-05 09:45:13

标签: python

我想执行此导入:

from tests.db.connection_tests import ConnectionTests

其中tests包含名为db。的模块。

我收到ImportError: No module named 'tests.db'

测试结构如下:

tests
    |
    db
        |
        connection_tests.py
    |
    moduleA

问题似乎是Python已经有一个名为tests的模块。我想到的唯一选择是重命名测试模块。

1 个答案:

答案 0 :(得分:0)

尝试将PYTHONPATH env变量设置为test文件夹的路径。