python - Pytest init setup for few modules -
say have next tests structure:
test/ module1/ test1.py module2/ test2.py module3/ test3.py
how can setup method called once before tests?
you can use autouse fixtures:
# content of test/conftest.py import pytest @pytest.fixture(scope="session", autouse=true) def execute_before_any_test(): # setup code goes here, executed ahead of first test
see pytest fixture docs more info.
Comments
Post a Comment