-
Notifications
You must be signed in to change notification settings - Fork 4
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
Adds unique tests names validator #7
Conversation
error_msg = self.error_template.format(node_name) | ||
self.add_error((node.lineno, 0, error_msg)) | ||
|
||
def _is_properly_node(self, node: ast.AST) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is copy paste. We use this method already in 3 places and 2 of them have similar code. I think we should move this method to BaseWatcher
, make it public, and override where we need other logic (like here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, we have similar case in another PR. Please, take a look, maybe we will do it earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 35f68b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a comment
@lowitea also please, update README with this feature description. |
1ac7326
to
fcbf21d
Compare
return | ||
|
||
for node in ast.walk(self.tree): | ||
if not self._is_test_function(node): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost done :)
Better call _should_check_node
method in this place. This is because the should_check method tells us whether handle this node or just skip it. By default, this method checks that node is test function.
But it can be something else, for example here we need more complex condition to check. So, we are overriding the default behavior and keeping the methods naming consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
@lowitea take a look at this comment, please. Also, you have a broken build. Please fix it, before merge. |
a073b63
to
c3a82ca
Compare
I updated readme and fixed ci. But maybe there is a regression after #8. I am failing tests with examples like this: @ pytest.mark.parametrize ('test', ('test',))
def test_not_uniq_with_decorator (test):
pass
@ pytest.mark.parametrize ('test', ('test2',))
def test_not_uniq_with_decorator (test):
pass Fell with error "FP009 test_not_uniq_with_decorator should use fixtures as follows" |
Nevertheless, I fixed the tests. A bug or a feature, but definitely does not apply to the current issue |
Nice job :) |
Adds unique tests names validator (best-doctor#7)
Hi @mcproger best-doctor/flake8-annotations-coverage#11 |
Hi @lowitea
You can send me email :)
Unfortunately, I am not a collaborator of these projects. I'll ask my team, but I'm afraid it may take a while. |
@mcproger unfortunately I could not find your email ok, thanks a lot anyway |
@lowitea you can see it in my profile – [email protected] |
Thanks!) |
closes #3