use @pytest.fixture over @pytest.fixture()
pytest-fixture-no-parentheses
Boolean flag specifying whether@pytest.fixture()
without parameters should have parentheses.
If the option is set to true (the default),@pytest.fixture
is valid and@pytest.fixture()
is an error.
If set to false,@pytest.fixture()
is valid and@pytest.fixture
is an error.
Bad code (assuming pytest-fixture-no-parentheses
set to true):
import pytest
@pytest.fixture()
def my_fixture():
...
Good code:
import pytest
@pytest.fixture
def my_fixture():
...
- to enforce consistency between all fixtures in a codebase