def setup():
    _venture = Venture(CONFIG.TENANT_INDEX)
    _project = _venture.get_project(CONFIG.PROJECT_INDEX)
    for ann in _venture.list_announcements(project_id=_project.project_id):
        _venture.delete_announcement(announcement_id=ann.id)
    _venture.post_announcement(project_id=_project.project_id,
                               **TEST_PROJECT_ANNOUNCEMENT)
    return _venture, _project
def setup(request):
    _staff = Staff(CONFIG.STAFF_INDEX)
    _venture = Venture(CONFIG.VENTURE_INDEX)
    _project = _venture.get_project(CONFIG.PROJECT_INDEX)
    assert _project.project_id, "需要先创建一个项目"
    for ann in _venture.list_announcements(project_id=_project.project_id):
        _venture.delete_announcement(ann.id)

    _venture.post_announcement(**TEST_PROJECT_ANNOUNCEMENT, project_id=_project.project_id)

    def finalize():
        for ann in _venture.list_announcements(project_id=_project.project_id):
            _venture.delete_announcement(ann.id)

    request.addfinalizer(finalize)
    return _staff, _venture, _project