test_multipletg.py 文件源码

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

项目:taf 作者: taf3 项目源码 文件源码
def start(self, request, monkeypatch):
        _env_list = self.env
        _setup_dict = self.setup_dict

        # first method for monkeypatching
        def _setup(self, x):
            _s = copy.deepcopy(_setup_dict)
            return _s

        # second method for monkeypatching
        def _conf(self, x):
            _e = copy.deepcopy(_env_list)
            return _e

        # monkeypatching methods _get_conf and _get_setup
        monkeypatch.setattr(common3.Environment, "_get_conf", _conf)
        monkeypatch.setattr(common3.Environment, "_get_setup", _setup)

        # define environment with fake class
        # mock Tkinter so we don't need Ixia installed
        # I only know how to do this with mock, if monkeypatch can do this we should use that
        with patch.dict('sys.modules', {'Tkinter': MagicMock()}):
            env = common3.Environment(FakeOpts())

        return env


# fake class for options
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号