0

我知道在 python 中使用 mox,我们可以模拟类属性或方法的行为。但是当我们新建一个实例或目标类时,它会在它的“import ...”类中做很多事情。我的问题是如何模拟 mox 中的“import ..”类行为?在客户端.py

from my.test import hander
......

在hander.py中:

def _doLotOfThings():
#do a lot of things
_doLotOfThings()

有没有办法在导入hander 之前注入hander.py 的_doLotOfThings() 让它什么都不做?

谢谢。

4

0 回答 0