PEP8 将变量引用 @pytest.fixture 标记为“来自外部范围的阴影名称”

Blu*_*hin 5 python pep8 pytest

我有一个简单的 pytest 问题:

import pytest

@pytest.fixture
def config():
    return "abc"

def mytest(config):
    print(config)
Run Code Online (Sandbox Code Playgroud)

该消息在def mytest(config):.

有什么建议可以处理这个 PEP8 消息吗?

Ste*_*uch 3

根据发出警告的人,可以将其抑制,如下所示:

抑制 pylint 警告:

# pylint: disable=R0801
def mytest(x_config):
    print(x_config)
Run Code Online (Sandbox Code Playgroud)

抑制pycharm警告:

# noinspection 801,PyShadowingNames
def mytest(x_config):
    print(x_config)
Run Code Online (Sandbox Code Playgroud)