Repository navigation
[flake8-pytest-style] Test function parameters with default arguments (PT028) - #15449
Conversation
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PT028 | 95 | 95 | 0 | 0 | 0 |
|
Aside from that change, I think |
MichaReiser
left a comment
There was a problem hiding this comment.
Thank you. I've a few comments regarding the implementation and I think we should remove the fix.
|
Did you review the ecosystem changes? |
|
@MichaReiser Yes. There are a couple of false positives. For example: def test_parallel(num_threads=2, kwargs_list=None):
"""
Decorator to run the same function multiple times in parallel.
...
"""
...def test_server_running(
skip_provision_check: bool = False,
external_host: str = "testserver",
log_file: str | None = None,
dots: bool = False,
) -> Iterator[None]:
...These kinds of false positives can be reduced (the former would no longer be reported) by making |
MichaReiser
left a comment
There was a problem hiding this comment.
Thanks for addressing the feedback.
I'm leaning towards not adding the is this a pytest file just yet because it would introduce the need for a new option for those not using the default file name patterns. We can decide to restrict the rule in the future if this comes up often. The other reason why I'm for deferring is that there are still some false negatives because many of the non-test test functions are defined in files prefixed with test_
Summary
Resolves #15412.
Test Plan
cargo nextest runandcargo insta test.