pytest-mypy icon indicating copy to clipboard operation
pytest-mypy copied to clipboard

Add --no-mypy option to disable mypy check

Open pwildenhain opened this issue 3 years ago • 2 comments

Right now I have --mypy in my pytest.ini file so that mypy runs by default when my tests are run, both locally and in CI

However, when I'm quickly iterating in testing a new feature, I would like to skip the mypy check since I first just want to make sure that the feature works.

Having a --no-mypy option to pass through to pytest when running locally would be great, rather than having to just deal with the mypy run each time, or go and manually modify my pytest.ini file to comment out the --mypy option.

The pytest-pylint and pytest-cov plugins provide this functionality:

  • https://github.com/carsongee/pytest-pylint/blob/781d6a8d67377b543756d0123c6259b8df77c0a8/pytest_pylint/plugin.py#L33-L38
  • https://github.com/pytest-dev/pytest-cov/blob/00713b3fec90cb8c98a9e4bfb3212e574c08e67b/src/pytest_cov/plugin.py#L110-L112

I'm happy to add a PR if you agree that this is a worthwhile feature

pwildenhain avatar Aug 26 '22 19:08 pwildenhain

You might also consider using pytest-enabler, which supplies the behavior you seek and doesn't require each plugin to have its own disable flag. That's what I use in my projects.

jaraco avatar Nov 08 '22 10:11 jaraco