我有这样的包装纸
def external_services_mock(f):
@patch('service.remote_call1')
@patch('service.remote_call2')
def wrapper(self, remote_call2_mock, remote_call1_mock, *args, **kwargs):
remote_call1_mock.return_value = None
def test_mocks():
return remote_call1_mock, remote_call2_mock
f(self, test_mocks, *args, **kwargs)
return wrapper
并测试:
@external_services_mock
def test_add_callback(self, test_mocks):
remote_call1_mock, remote_call2_mock = test_mocks()
// do smth
// assert smth
django_nose runner 忽略包装的测试,并正常运行
Django 版本 2.0.2 django_nose 1.4.5
有任何想法吗?