.. _redefined-outer-name: redefined-outer-name / W0621 ============================ **Message emitted:** ``Redefining name %r from outer scope (line %s)`` **Description:** *Used when a variable's name hides a name defined in an outer scope or except handler.* **Problematic code:** .. literalinclude:: /data/messages/r/redefined-outer-name/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/r/redefined-outer-name/good.py :language: python **Additional details:** A common issue is that this message is triggered when using `pytest` `fixtures `_: .. 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 `_ can be used. Created by the `variables `__ checker.