test_runner.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:systemdlogger 作者: techjacker 项目源码 文件源码
def setup_method(self, method):
        """ setup any state tied to the execution of the given method in a
        class.  setup_method is invoked for every test method of a class.
        """

        self.journal_mock = Mock()
        self.cw_mock = Mock()
        self.cw_mock.CloudwatchLogger.return_value = 'hello'
        self.es_mock = Mock()
        self.es_mock.ElasticsearchLogger.return_value = 'bye'

        modules = {
            'systemdlogger.journal': self.journal_mock,
            'systemdlogger.cloudwatch': self.cw_mock,
            'systemdlogger.elasticsearch': self.es_mock
        }
        self.module_patcher = patch.dict('sys.modules', modules)
        self.module_patcher.start()
        from systemdlogger.runner import Runner
        self.Runner = Runner
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号