pre-commit run --all-files An error has occurred: InvalidManifestError: while configure pytest

197 Views Asked by At

steps:

  1. I was installed -->
$ pre-commit install
pre-commit installed at .git/hooks/pre-commit

2.create .pre-commit-config.yaml file then add configuration. this is my pytest configuration

- repo: https://github.com/pytest-dev/pytest
    rev: 7.4.3 
    hooks:
      - id: pytest

while run the pre-commit run --all-files i got error on pytest section

error:

[INFO] Initializing environment for https://github.com/pytest-dev/pytest.
An error has occurred: InvalidManifestError: 
=====> /home/mutharasu/.cache/pre-commit/repofxmga3dy/.pre-commit-hooks.yaml is not a file

Check the log at /home/mutharasu/.cache/pre-commit/pre-commit.log

i want run successfully on that pre-commit run --all-files command

1

There are 1 best solutions below

2
anthony sottile On

pytest-dev/pytest does not provide a hook for use with pre-commit -- that is it does not contain a .pre-commit-hooks.yaml file with information.

I'm not sure where you found that yaml snippet from, but it is not valid (perhaps you made it up?)

and as both a pytest core dev and the creator of pre-commit it shouldn't -- running tests as part of your commit is going to be too slow and is going to frustrate your contributors. plus pre-commit never installs the "repository under test" so you won't be able to have any of your dependencies available