Как правильно смоделировать класс во время импорта с помощью pytest?Например:
#main_module.py
from james import John
class Fish:
def run():
return John()
#test_main_module.py
@patch('path/to/main_module/where/John/was/used')
def test_main_module_uses_mork(mocker):
MockJohn = mocker.Mock()
assert type(Fish().run()) == MockJohn