conftest.py 781 Bytes
Newer Older
xcn committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   test_58
# FileName:      conftest.py
# Author:       xxxxxxx
# Datetime:     2024/1/4 11:31
# Description:
# 主要创建自定固件
# ---------------------------------------------------------------------------
import pytest
from InterfaceAutoTest.common.db import DB
from InterfaceAutoTest.requests_method.requests_method import RequestsMethod


# 创建DB对象的自定义固件
@pytest.fixture(scope="session")
def db_fix():
    # 创建DB对象, 并返回
    db = DB()
    yield db
    db.close()


# 创建RequestsMethod类对象
@pytest.fixture(scope="session")
def req_fix():
    # 创建RequestsMethod类对象
    req = RequestsMethod()
    yield req