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

Add a flag to skip black formatting #51

Open
orf opened this issue Oct 16, 2020 · 2 comments · May be fixed by insertjokehere/pytest-black-ng#3
Open

Add a flag to skip black formatting #51

orf opened this issue Oct 16, 2020 · 2 comments · May be fixed by insertjokehere/pytest-black-ng#3

Comments

@orf
Copy link

orf commented Oct 16, 2020

In our projects setup.cfg we often add --black via addopts, so our CI always runs with black and any other project specific options that may be required:

[tool:pytest]
addopts = -n auto --black

However there are often cases when developing locally you do not wish to have your tests fail due to black. This poses a problem, because you have to edit your setup.cfg to remove --black and remember to add it back again when committing.

It would be really handy to have a --no-black argument that can be given that overrides the --black flag, if present. So a full invocation might expand to pytest --black --no-black, which would not run black.

@C0DK
Copy link

C0DK commented Oct 21, 2020

This seems very much like an issue with your setup - not the tool. It would require the tool to make an additional flag for having the flag but not seriously meaning it.

I am not the author of this project though, so I have no real say. Just my five cent.

@orf
Copy link
Author

orf commented Oct 31, 2020

This seems very much like an issue with your setup - not the tool. It would require the tool to make an additional flag for having the flag but not seriously meaning it.

This was also added to pytest-pylint for the same reasons. Using setup.cfg to enforce consistent pytest options is a very, very common (and recommended) pattern. The downside of this is it's annoying to remove some flags, which is usually only needed with plugins like pylint or black.

So yeah it would require adding an additional flag, but the only setup that's at fault here is pytest :(

@pjonsson pjonsson linked a pull request Feb 18, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants