summaryrefslogtreecommitdiff
path: root/doc/data/messages/r/redefined-outer-name/details.rst
blob: 475e6a344898d59ec8f586b49c344e38f4888ed7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
A common issue is that this message is triggered when using `pytest` `fixtures <https://docs.pytest.org/en/7.1.x/how-to/fixtures.html>`_:

.. code-block:: python

    import pytest

    @pytest.fixture
    def setup():
        ...


    def test_something(setup):  # [redefined-outer-name]
        ...

One solution to this problem is to explicitly name the fixture:

.. code-block:: python

    @pytest.fixture(name="setup")
    def setup_fixture():
        ...

Alternatively `pylint` plugins like `pylint-pytest <https://pypi.org/project/pylint-pytest/>`_ can be used.