test_local.py 文件源码

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

项目:py 作者: pytest-dev 项目源码 文件源码
def batch_make_numbered_dirs(rootdir, repeats):
    try:
        for i in range(repeats):
            dir_ = py.path.local.make_numbered_dir(prefix='repro-', rootdir=rootdir)
            file_ = dir_.join('foo')
            file_.write('%s' % i)
            actual = int(file_.read())
            assert actual == i, 'int(file_.read()) is %s instead of %s' % (actual, i)
            dir_.join('.lock').remove(ignore_errors=True)
        return True
    except KeyboardInterrupt:
        # makes sure that interrupting test session won't hang it
        os.exit(2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号