转载自:pytest cmd下执行报错make sure your test modules/packages have valid Python names._conftest.py importerror while importing test modul_日日记的博客-CSDN博客

在执行的case文件目录下新建conftest.py文件,内容写:

import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))