-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
Make sure we treat tests differently #1120
Comments
Yes, this is true. I usually disable this check for all |
Will do! |
@sponsfreixes are you still interested in fixing docs for this one? 🙂 |
I think it would be really useful for new users to have somewhere in docs any example of |
@skarzi completely agree! I think even a whole new documentation entry under |
Whoa, it has been already a month since my last comment 😬 Yeah, I was still planning to do it. If somebody wants to steal it before I start, feel free to change assignee. @skarzi what other violations should be ignored on tests? |
Here several my projects that have a list of ignored violations for tests:
Here's the ignore line for one private project:
Basically I ignore:
I can also ignore new violations from new linter versions in tests, because refactoring them is error-prone and has little value. |
My
|
@sponsfreixes friendly ping. Are you still planing to work on this task? Do you need any help? |
Might be related: #1268 Maybe we can use some kind of I don't see much value in just updating the docs for this one. I suggest to add a feature that will solve this case. |
|
Could as well just read the pytest config to find out the patterns instead of having a separate flake8 setting... |
One can use |
It's not interfering. You'd just construct the default value of the flake8 setting based on what you see in the project dir. |
Can you please give a more detailed example of how do you see this process? |
So we add a setting like |
Here's another case: @pytest.mark.parametrize(
('is_crashing', 'is_strict'),
(
pytest.param(True, True, id='strict xfail'),
pytest.param(False, True, id='strict xpass'),
pytest.param(True, False, id='non-strict xfail'),
pytest.param(False, False, id='non-strict xpass'),
),
)
def test_xfail(is_crashing, is_strict, testdir):
"""Test xfail/xpass/strict permutations."""
... Boolean literals in |
When using pytest fixtures, you are supposed to just declare them as input arguments, and they will be automagically loaded. For example:
This will violate rule 442, which is not desired in this case.
One could argue that fixtures should live on a different file than tests, but you run on the same issue if you have fixtures dependent on other fixtures:
I think we need to make this feature "pytest aware", or just document that it there is conflict with it and might need to be disabled.
The text was updated successfully, but these errors were encountered: