How to know the execution order of pytest hooks?
04:42 16 Aug 2023

I am using pytest framework for testing purpose. When i start test_abc.py file , i saw that first of all pytest_configure is executed, then pytest_addoption ...

So my question is: how we can know that pytest_configure is executed at the beginning and how the others execution order?

Here is my conftest.py file:

def pytest_addoption(parser):
    print("pytest_addoption")
def pytest_exception_interact(
        node: Union["Item", "Collector"],
        call: "CallInfo[Any]",
        report: Union["CollectReport", "TestReport"],
) -> None:
    print("pytest exception interact")
def pytest_configure(config):
    print("pytest configure")
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item):
    print("pytest runtest makereport")
def pytest_runtest_setup(item):
    print("pytest runtest setup")
def pytest_report_header(config):
    print("pytest report header")```
python plugins pytest hook