0

Below is the structure of my project and when I run pre-commit, pylint hook fails with the following errors.

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)

Here is the 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)

Here is the .pre-commit-config.yaml and the hook is configured as local as explained here

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]

Please help figure out what I'm missing

Project structure

Somasundaram Sekar
  • 5,244
  • 6
  • 43
  • 85

0 Answers0