-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change default for PT001 and PT023 (#12838)
Co-authored-by: Alex Waygood <[email protected]>
- Loading branch information
1 parent
9fd8aaa
commit 2e211c5
Showing
15 changed files
with
351 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 102 additions & 36 deletions
138
...pytest_style/snapshots/ruff_linter__rules__flake8_pytest_style__tests__PT001_default.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,127 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs | ||
--- | ||
PT001.py:9:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | ||
PT001.py:14:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | ||
| | ||
9 | @pytest.fixture | ||
| ^^^^^^^^^^^^^^^ PT001 | ||
10 | def no_parentheses(): | ||
11 | return 42 | ||
14 | @pytest.fixture() | ||
| ^^^^^^^^^^^^^^^^^ PT001 | ||
15 | def parentheses_no_params(): | ||
16 | return 42 | ||
| | ||
= help: Add parentheses | ||
= help: Remove parentheses | ||
|
||
ℹ Safe fix | ||
6 6 | # `import pytest` | ||
7 7 | | ||
8 8 | | ||
9 |-@pytest.fixture | ||
9 |+@pytest.fixture() | ||
10 10 | def no_parentheses(): | ||
11 11 | return 42 | ||
12 12 | | ||
13 13 | | ||
14 |-@pytest.fixture() | ||
14 |+@pytest.fixture | ||
15 15 | def parentheses_no_params(): | ||
16 16 | return 42 | ||
17 17 | | ||
|
||
PT001.py:34:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | ||
PT001.py:24:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | ||
| | ||
34 | @fixture | ||
| ^^^^^^^^ PT001 | ||
35 | def imported_from_no_parentheses(): | ||
36 | return 42 | ||
24 | / @pytest.fixture( | ||
25 | | | ||
26 | | ) | ||
| |_^ PT001 | ||
27 | def parentheses_no_params_multiline(): | ||
28 | return 42 | ||
| | ||
= help: Add parentheses | ||
= help: Remove parentheses | ||
|
||
ℹ Safe fix | ||
21 21 | return 42 | ||
22 22 | | ||
23 23 | | ||
24 |-@pytest.fixture( | ||
25 |- | ||
26 |-) | ||
24 |+@pytest.fixture | ||
27 25 | def parentheses_no_params_multiline(): | ||
28 26 | return 42 | ||
29 27 | | ||
|
||
PT001.py:39:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | ||
| | ||
39 | @fixture() | ||
| ^^^^^^^^^^ PT001 | ||
40 | def imported_from_parentheses_no_params(): | ||
41 | return 42 | ||
| | ||
= help: Remove parentheses | ||
|
||
ℹ Safe fix | ||
31 31 | # `from pytest import fixture` | ||
32 32 | | ||
33 33 | | ||
34 |-@fixture | ||
34 |+@fixture() | ||
35 35 | def imported_from_no_parentheses(): | ||
36 36 | return 42 | ||
37 37 | | ||
38 38 | | ||
39 |-@fixture() | ||
39 |+@fixture | ||
40 40 | def imported_from_parentheses_no_params(): | ||
41 41 | return 42 | ||
42 42 | | ||
|
||
PT001.py:59:1: PT001 [*] Use `@pytest.fixture()` over `@pytest.fixture` | ||
PT001.py:49:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | ||
| | ||
59 | @aliased | ||
| ^^^^^^^^ PT001 | ||
60 | def aliased_no_parentheses(): | ||
61 | return 42 | ||
49 | / @fixture( | ||
50 | | | ||
51 | | ) | ||
| |_^ PT001 | ||
52 | def imported_from_parentheses_no_params_multiline(): | ||
53 | return 42 | ||
| | ||
= help: Add parentheses | ||
= help: Remove parentheses | ||
|
||
ℹ Safe fix | ||
46 46 | return 42 | ||
47 47 | | ||
48 48 | | ||
49 |-@fixture( | ||
50 |- | ||
51 |-) | ||
49 |+@fixture | ||
52 50 | def imported_from_parentheses_no_params_multiline(): | ||
53 51 | return 42 | ||
54 52 | | ||
|
||
PT001.py:64:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | ||
| | ||
64 | @aliased() | ||
| ^^^^^^^^^^ PT001 | ||
65 | def aliased_parentheses_no_params(): | ||
66 | return 42 | ||
| | ||
= help: Remove parentheses | ||
|
||
ℹ Safe fix | ||
56 56 | # `from pytest import fixture as aliased` | ||
57 57 | | ||
58 58 | | ||
59 |-@aliased | ||
59 |+@aliased() | ||
60 60 | def aliased_no_parentheses(): | ||
61 61 | return 42 | ||
62 62 | | ||
63 63 | | ||
64 |-@aliased() | ||
64 |+@aliased | ||
65 65 | def aliased_parentheses_no_params(): | ||
66 66 | return 42 | ||
67 67 | | ||
|
||
PT001.py:74:1: PT001 [*] Use `@pytest.fixture` over `@pytest.fixture()` | ||
| | ||
74 | / @aliased( | ||
75 | | | ||
76 | | ) | ||
| |_^ PT001 | ||
77 | def aliased_parentheses_no_params_multiline(): | ||
78 | return 42 | ||
| | ||
= help: Remove parentheses | ||
|
||
ℹ Safe fix | ||
71 71 | return 42 | ||
72 72 | | ||
73 73 | | ||
74 |-@aliased( | ||
75 |- | ||
76 |-) | ||
74 |+@aliased | ||
77 75 | def aliased_parentheses_no_params_multiline(): | ||
78 76 | return 42 |
Oops, something went wrong.