Fixtures’ Scopes

pytest
Author

Imad Dabbura

Published

December 26, 2022

Scopes of fixtures:

A fixture can only depend on another fixture that is at the same scope level or wider. Also, for package/session scopes, the fixtures have to be defined inside conftest.py (typically in the root of test directory) that will be read by pytest before running tests in order to be actually at the package/session level; otherwise, they will default to the module.