def configreader(section, key):
config = configparser.ConfigParser()
config.read("../ConfigFiles/baseURL.cfg")
return config.get(section, key)
在pytest模式下运行代码时,遇到" no ection:'depta''错误,但是当代码本身启动时(独立(时,没有错误。
更新:已解决,是语法错误
config.read(" ./configfiles/baseurl.cfg"(
摆脱了'。要从顶级文件夹启动代码。
希望它有帮助。