target should be a string in the form 'package.module.ClassName'. The
target is imported and the specified object replaced with the new
object, so the target must be importable from the environment you are
calling patch() from. The target is imported when the decorated
function is executed, not at decoration time.
得到} 很清楚这一点:
ModuleNotFoundError
,因为funcion2
不是模块。^{当从文件所在的目录中使用
python3 -m unittest discover
执行时,这对我很有用。在顺便说一句,在你的例子中有几个拼写错误,例如
Abc().funcion2()
,请注意funcion2
中缺少的t
。在{{8}也不要使用
^{pr2}$相关问题 更多 >
编程相关推荐