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

Remove @ in pytest.mark.parametrize rule messages #14770

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl Violation for PytestParametrizeNamesWrongType {
}
}
};
format!("Wrong type passed to first argument of `@pytest.mark.parametrize`; expected {expected_string}")
format!("Wrong type passed to first argument of `pytest.mark.parametrize`; expected {expected_string}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

fn fix_title(&self) -> Option<String> {
Expand Down Expand Up @@ -210,7 +210,7 @@ impl Violation for PytestParametrizeValuesWrongType {
#[derive_message_formats]
fn message(&self) -> String {
let PytestParametrizeValuesWrongType { values, row } = self;
format!("Wrong values type in `@pytest.mark.parametrize` expected `{values}` of `{row}`")
format!("Wrong values type in `pytest.mark.parametrize` expected `{values}` of `{row}`")
}

fn fix_title(&self) -> Option<String> {
Expand Down Expand Up @@ -273,7 +273,7 @@ impl Violation for PytestDuplicateParametrizeTestCases {
#[derive_message_formats]
fn message(&self) -> String {
let PytestDuplicateParametrizeTestCases { index } = self;
format!("Duplicate of test case at index {index} in `@pytest_mark.parametrize`")
format!("Duplicate of test case at index {index} in `pytest.mark.parametrize`")
}

fn fix_title(&self) -> Option<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values
PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected a string of comma-separated values
|
24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -21,7 +21,7 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
26 26 | ...
27 27 |

PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str`
PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
|
29 | @pytest.mark.parametrize(("param1",), [1, 2, 3])
| ^^^^^^^^^^^ PT006
Expand All @@ -40,7 +40,7 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
31 31 | ...
32 32 |

PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values
PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected a string of comma-separated values
|
34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -59,7 +59,7 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
36 36 | ...
37 37 |

PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str`
PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
|
39 | @pytest.mark.parametrize(["param1"], [1, 2, 3])
| ^^^^^^^^^^ PT006
Expand All @@ -78,7 +78,7 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
41 41 | ...
42 42 |

PT006.py:44:26: PT006 Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values
PT006.py:44:26: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected a string of comma-separated values
|
44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3])
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -87,7 +87,7 @@ PT006.py:44:26: PT006 Wrong type passed to first argument of `@pytest.mark.param
|
= help: Use a string of comma-separated values for the first argument

PT006.py:49:26: PT006 Wrong type passed to first argument of `@pytest.mark.parametrize`; expected a string of comma-separated values
PT006.py:49:26: PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected a string of comma-separated values
|
49 | @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3])
| ^^^^^^^^^^^^^^^^^^^^^ PT006
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^ PT006
Expand All @@ -21,7 +21,7 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa
11 11 | ...
12 12 |

PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -40,7 +40,7 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
16 16 | ...
17 17 |

PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^ PT006
Expand All @@ -59,7 +59,7 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
21 21 | ...
22 22 |

PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str`
PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
|
29 | @pytest.mark.parametrize(("param1",), [1, 2, 3])
| ^^^^^^^^^^^ PT006
Expand All @@ -78,7 +78,7 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
31 31 | ...
32 32 |

PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -97,7 +97,7 @@ PT006.py:34:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
36 36 | ...
37 37 |

PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str`
PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
|
39 | @pytest.mark.parametrize(["param1"], [1, 2, 3])
| ^^^^^^^^^^ PT006
Expand All @@ -116,7 +116,7 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
41 41 | ...
42 42 |

PT006.py:44:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:44:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3])
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -135,7 +135,7 @@ PT006.py:44:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
46 46 | ...
47 47 |

PT006.py:49:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:49:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
49 | @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3])
| ^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -154,7 +154,7 @@ PT006.py:49:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
51 51 | ...
52 52 |

PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -173,7 +173,7 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
56 56 | ...
57 57 |

PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -192,7 +192,7 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
61 61 | ...
62 62 |

PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -211,7 +211,7 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
66 66 | ...
67 67 |

PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
|
69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^ PT006
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list`
PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `list`
|
9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^ PT006
Expand All @@ -21,7 +21,7 @@ PT006.py:9:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.pa
11 11 | ...
12 12 |

PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list`
PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `list`
|
14 | @pytest.mark.parametrize(" param1, , param2 , ", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -40,7 +40,7 @@ PT006.py:14:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
16 16 | ...
17 17 |

PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list`
PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `list`
|
19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^ PT006
Expand All @@ -59,7 +59,7 @@ PT006.py:19:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
21 21 | ...
22 22 |

PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list`
PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `list`
|
24 | @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -78,7 +78,7 @@ PT006.py:24:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
26 26 | ...
27 27 |

PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str`
PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
|
29 | @pytest.mark.parametrize(("param1",), [1, 2, 3])
| ^^^^^^^^^^^ PT006
Expand All @@ -97,7 +97,7 @@ PT006.py:29:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
31 31 | ...
32 32 |

PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `str`
PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
|
39 | @pytest.mark.parametrize(["param1"], [1, 2, 3])
| ^^^^^^^^^^ PT006
Expand All @@ -116,7 +116,7 @@ PT006.py:39:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
41 41 | ...
42 42 |

PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list`
PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `list`
|
54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -135,7 +135,7 @@ PT006.py:54:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
56 56 | ...
57 57 |

PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list`
PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `list`
|
59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -154,7 +154,7 @@ PT006.py:59:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
61 61 | ...
62 62 |

PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list`
PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `list`
|
64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PT006
Expand All @@ -173,7 +173,7 @@ PT006.py:64:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.p
66 66 | ...
67 67 |

PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `list`
PT006.py:69:26: PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `list`
|
69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)])
| ^^^^^^^^^^^^^^^^^ PT006
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
snapshot_kind: text
---
PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:4:35: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
4 | @pytest.mark.parametrize("param", (1, 2))
| ^^^^^^ PT007
Expand All @@ -21,7 +21,7 @@ PT007.py:4:35: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte
6 6 | ...
7 7 |

PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:11:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
9 | @pytest.mark.parametrize(
10 | ("param1", "param2"),
Expand Down Expand Up @@ -50,7 +50,7 @@ PT007.py:11:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte
16 16 | def test_tuple_of_tuples(param1, param2):
17 17 | ...

PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:12:9: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
10 | ("param1", "param2"),
11 | (
Expand All @@ -71,7 +71,7 @@ PT007.py:12:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte
14 14 | ),
15 15 | )

PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:13:9: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
11 | (
12 | (1, 2),
Expand All @@ -92,7 +92,7 @@ PT007.py:13:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte
15 15 | )
16 16 | def test_tuple_of_tuples(param1, param2):

PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:22:5: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
20 | @pytest.mark.parametrize(
21 | ("param1", "param2"),
Expand Down Expand Up @@ -121,7 +121,7 @@ PT007.py:22:5: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte
27 27 | def test_tuple_of_lists(param1, param2):
28 28 | ...

PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:39:9: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
37 | ("param1", "param2"),
38 | [
Expand All @@ -142,7 +142,7 @@ PT007.py:39:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte
41 41 | ],
42 42 | )

PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:40:9: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
38 | [
39 | (1, 2),
Expand All @@ -163,7 +163,7 @@ PT007.py:40:9: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expecte
42 42 | )
43 43 | def test_list_of_tuples(param1, param2):

PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:81:38: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
80 | @pytest.mark.parametrize("a", [1, 2])
81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6)))
Expand All @@ -183,7 +183,7 @@ PT007.py:81:38: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect
83 83 | @pytest.mark.parametrize(
84 84 | "d",

PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:81:39: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
80 | @pytest.mark.parametrize("a", [1, 2])
81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6)))
Expand All @@ -203,7 +203,7 @@ PT007.py:81:39: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expect
83 83 | @pytest.mark.parametrize(
84 84 | "d",

PT007.py:81:47: PT007 [*] Wrong values type in `@pytest.mark.parametrize` expected `list` of `list`
PT007.py:81:47: PT007 [*] Wrong values type in `pytest.mark.parametrize` expected `list` of `list`
|
80 | @pytest.mark.parametrize("a", [1, 2])
81 | @pytest.mark.parametrize(("b", "c"), ((3, 4), (5, 6)))
Expand Down
Loading
Loading