Pytest: pre-commit fails on seemingly unrelated lines for step 'mypy'

Created on 13 Jun 2020  路  4Comments  路  Source: pytest-dev/pytest

It looks like pre-commit is failing for commits made on branches created off of master from at least commit https://github.com/pytest-dev/pytest/commit/aaa6f1c3fab98adc04fde6cc971c2b385fb583f1.

Locally for me pre-commit fails even after I uninstall and reinstall pre-commit ( as detailed here https://github.com/pytest-dev/pytest/blob/3100f8ec29c3b14168e0644d668b2a17d5f30280/CONTRIBUTING.rst#long-version )

The failure is:

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

src/_pytest/config/__init__.py:1076: error: Argument 1 to "Version" has incompatible type "Union[str, List[str]]"; expected "str"  [arg-type]
Found 1 error in 1 file (checked 2 source files)

rst..................................................(no files to check)Skipped

It's worth noting that the line in question was last modified 14 months ago

bug

Most helpful comment

a5ab7c19fb44cc5177faea95a8f2322af6f2b415 fixes this. Not sure why CI doesn't pick up on it, probably the linting tox env doesn't have the packaging package installed, or is using an old version without type hints. Worth investigating if you're inclined :)

All 4 comments

a5ab7c19fb44cc5177faea95a8f2322af6f2b415 fixes this. Not sure why CI doesn't pick up on it, probably the linting tox env doesn't have the packaging package installed, or is using an old version without type hints. Worth investigating if you're inclined :)

@bluetech why is this closed? I can鈥檛 commit anything because of the error. What is the proper fix to get pre-commit working again?

Didn't realize the posted commit was submitted after my own. Thanks @bluetech let me see if fetching master fixes it.

Yep, looks like I didn't have that commit @bluetech thanks for the prompt response

Was this page helpful?
0 / 5 - 0 ratings