pytester.py 文件源码

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

项目:hostapd-mana 作者: adde88 项目源码 文件源码
def __init__(self, request, tmpdir_factory):
        self.request = request
        # XXX remove duplication with tmpdir plugin
        basetmp = tmpdir_factory.ensuretemp("testdir")
        name = request.function.__name__
        for i in range(100):
            try:
                tmpdir = basetmp.mkdir(name + str(i))
            except py.error.EEXIST:
                continue
            break
        self.tmpdir = tmpdir
        self.plugins = []
        self._savesyspath = (list(sys.path), list(sys.meta_path))
        self._savemodulekeys = set(sys.modules)
        self.chdir() # always chdir
        self.request.addfinalizer(self.finalize)
        method = self.request.config.getoption("--runpytest")
        if method == "inprocess":
            self._runpytest_method = self.runpytest_inprocess
        elif method == "subprocess":
            self._runpytest_method = self.runpytest_subprocess
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号