pytest给一个fixture加上scope="session"后报错

问题遇到的现象和发生背景

fixture_1类似于做接口检验的功能
fixture_2类似于登录
test_01为登录函数
test_02与test_03为需要登录后才可以请求的接口

我将fixture_2的scope改为=“session”后报错

问题相关代码,请勿粘贴截图
import pytest


@pytest.fixture()
def fixture_1():
    print("fixture_1")


@pytest.fixture(scope="session")
def fixture_2(fixture_1):
    test_01(fixture_1)
    print("fixture_2")



def test_01(fixture_1):
    print("test01")

def test_02(fixture_1,fixture_2):
    print("test_02")

def test_03(fixture_1,fixture_2):
    print("test_03")

运行结果及报错内容

ScopeMismatch: You tried to access the function scoped fixture fixture_1 with a session scoped request object, involved factories:
PycharmProjects\test\tests\111.py:9: def fixture_2(fixture_1)
PycharmProjects\test\tests\111.py:4: def fixture_1()

我的解答思路和尝试过的方法

去除掉=session后可以运行,但运行test_)02跟tes_03后每次都会先运行test01,这跟我的初衷违背

我想要达到的结果

每一个test都会有fixture1,除去test01,剩余接口都会请求到fixture2,但希望fixture2是session级别的

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。


因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。


```python
@pytest.fixture(scope="session")
def fixture_2():
  '''函数参数里的fixture_1去掉就好了'''
    test_01(fixture_1)
    print("fixture_2")



```