如果我有多个测试修补同一个模块,有没有一种方法不必在每个测试中修补它(即,排除它)
def test_1(mocker):
mocker.patch.object(module, 'method')
# run test
def test_2(mocker):
mocker.patch.object(module, 'method')
# run test
def test_3(mocker):
mocker.patch.object(module, 'method')
# run test
Tags:
是的,看看官方pytest文档中的autouse fixtures
相关问题 更多 >
编程相关推荐