Pre-commit: pytest doesn't locate tests

Created on 16 Apr 2018  路  3Comments  路  Source: pre-commit/pre-commit

Hi, I'm having a problem running a local command. I'm using pipenv to manage the environment, and I'm using pytest to run my tests. My tests are located in <project>/tests, and pytest locates/runs my tests when I do pipenv run pytest from the <project> directory. I tried to set up a pre-commit hook that runs pytest, and this is what it looks like:

- repo: local
  hooks:
  - id: pytest
    name: pytest
    entry: pipenv run pytest
    language: system

Here is the error that is produced:

pytest...................................................................Failed
hookid: pytest

============================= test session starts ==============================
platform darwin -- Python 3.6.5, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: <path to project>, inifile:
plugins: hypothesis-3.55.6

========================= no tests ran in 0.00 seconds =========================
ERROR: not found: <path to project>/.pre-commit-config.yaml
(no name '<path to project>/.pre-commit-config.yaml' in any of [])

ERROR: not found: <path to project>/Pipfile
(no name '<path to project>/Pipfile' in any of [])

ERROR: not found: <path to project>/Pipfile.lock
(no name '<path to project>/Pipfile.lock' in any of [])

I'm not sure what the last three errors are about (they don't show up when I run pytest on my own).

question

Most helpful comment

You'll want pass_filenames: false I believe. Those errors are coming from the modified files being passed to the command specified.

All 3 comments

You'll want pass_filenames: false I believe. Those errors are coming from the modified files being passed to the command specified.

That does it, thank you!

Thanks for the issue! 馃帀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jacobseiler picture jacobseiler  路  4Comments

fczuardi picture fczuardi  路  3Comments

metmajer picture metmajer  路  4Comments

DaveParr picture DaveParr  路  4Comments

hectorv picture hectorv  路  3Comments