小编Diy*_*bek的帖子

我如何解决从另一个模块导入的 pytest 夹具的 flake8“未使用的导入”错误

我在 Fixtures.py 文件中编写了 pytest 夹具,并在 main_test.py 中使用它。但我在 flake8 中收到此错误:F401 'utils_test.backup_path' 已导入但未用于此代码:

@pytest.fixture
def backup_path():
    ...
Run Code Online (Sandbox Code Playgroud)
from fixtures import backup_path


def test_filename(backup_path):
    ...
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

python pytest flake8

6
推荐指数
1
解决办法
2981
查看次数

标签 统计

flake8 ×1

pytest ×1

python ×1