How to invoke manually fixures in conftest

143 Views Asked by At

in my piece of code had several fixures which is running in session scope, and some fixure that is running each test (autouse=true) which is checking some condition and if the condition is true than call again to fixure which is in this case defined as session scope. does it possible to do?

P.S this piece of code is just a sample

import pytest


@pytest.fixture(scope='session')
def init_list():
    grate = ['A', 'B', 'C']
    print("A")
    return grate


@pytest.fixture(scope='session')
def get_A_grate(init_list):
    return init_list[0]

@pytest.fixture(autouse=True)
def init_again(get_A_grate):
    if get_A_grate == 'A':
        **init_list()**
0

There are 0 best solutions below