用 arg 代替 cls 构造函数

时间:2021-03-05 22:31:21

标签: python sqlalchemy pytest

Cls().method() 由 pytest func 中的代码调用。 我将如何使用 Cls(db_session)patch 替换为 cls 实例?

我在考虑以下几点:

with patch('tests.functional.test_file.Cls', Cls(db_session)):
    code that calls Cls().method()

0 个答案:

没有答案
相关问题