下面是我的项目的结构,当我运行预提交时,pylint 挂钩失败并出现以下错误。
pylint...................................................................Failed
- hook id: pylint
- exit code: 2
************* Module test_hello_world
tests/test_dags/test_hello_world.py:1:0: E0401: Unable to import 'dags' (import-error)
tests/test_dags/test_hello_world.py:2:0: E0401: Unable to import 'tests.dag_test_utilities' (import-error)
这里是test_hello_world.py
from dags import hello_world
from tests.dag_test_utilities import assert_dag_dict_equal
def test_dag_shape():
dag = hello_world.dag
assert_dag_dict_equal({"hello": ["world"], "world": []}, dag)
这是 .pre-commit-config.yaml 并且钩子被配置为本地的,如此处所述
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-docstring-first
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-ast
- repo: https://github.com/ambv/black
rev: 20.8b1
hooks:
- id: black
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: python
types: [python]
请帮助弄清楚我错过了什么
