Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deactivating the plugin #80

Open
m-aciek opened this issue Sep 6, 2021 · 2 comments
Open

Deactivating the plugin #80

m-aciek opened this issue Sep 6, 2021 · 2 comments

Comments

@m-aciek
Copy link

m-aciek commented Sep 6, 2021

Hi, I have pytest-flake8 installed, and in my pytest.ini file I have addopts: --flake8. In my CI I'd like to disable flake8 checks (I have separate job for them), but reuse other parts of the config. If I add -p no:flake8, the pytest invocation fails with:

% pytest tests -p no:flake8       
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --flake8
  inifile: …/pytest.ini
  rootdir: …

I didn't find any other way to disable the plugin using command line option. Is there any? If not, should it be fixed on pytest side or potentially added on pytest-flake8 side?

@m-aciek
Copy link
Author

m-aciek commented Sep 6, 2021

For what is worth I was able to disable the plugin by prepending pytest invocation on CI with:

- sed -i "s/--flake8//" pytest.ini  # removes --flake8 from pytest.ini
- pytest tests

@jaraco
Copy link

jaraco commented Nov 7, 2021

I have a similar issue. I've worked around the issue by using pytest-enabler. See https://github.com/jaraco/skeleton/blob/aae281a9ff6c9a1fa9daad82c79457e8770a1c7e/pyproject.toml#L16-L17. This plugin allows pytest-flake8 to be enabled when the plugin is enabled, but not when the plugin is not. By default, it's enabled, but one can pass -p no:flake8 to disable the plugin. Please give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants