标签: python sqlalchemy pytest
Cls().method() 由 pytest func 中的代码调用。 我将如何使用 Cls(db_session) 将 patch 替换为 cls 实例?
Cls().method()
Cls(db_session)
patch
我在考虑以下几点:
with patch('tests.functional.test_file.Cls', Cls(db_session)): code that calls Cls().method()