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 false (the default),@pytest.fixture()
is valid and@pytest.fixture
is an error.
If set to true,@pytest.fixture
is valid and@pytest.fixture()
is an error.
Bad code (assuming pytest-fixture-no-parentheses
set to false):
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