steps_checker.py 文件源码

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

项目:stepler 作者: Mirantis 项目源码 文件源码
def pytest_collection_modifyitems(config, items):
    """Hook to detect forbidden calls inside test."""
    if config.option.disable_steps_checker:
        config.warn('P1', 'Permitted calls checker is disabled!')
        return

    errors = []
    for item in items:
        permitted_calls = PERMITTED_CALLS + STEPS + item.funcargnames
        validator = TestValidator(item.function, permitted_calls)
        errors.extend(validator.validate())

    if errors:
        pytest.exit("Only steps and fixtures must be called in test!\n" +
                    '\n'.join(errors))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号