---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:9:26
   |
 9 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
   |                          ^^^^^^^^^^^^^^^
10 | def test_csv(param1, param2):
11 |     ...
   |
help: Use a `tuple` for the first argument
   |
8  |
   - @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
9  + @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
10 | def test_csv(param1, param2):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:14:26
   |
14 | @pytest.mark.parametrize("   param1,   ,    param2   , ", [(1, 2), (3, 4)])
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 | def test_csv_with_whitespace(param1, param2):
16 |     ...
   |
help: Use a `tuple` for the first argument
   |
13 |
   - @pytest.mark.parametrize("   param1,   ,    param2   , ", [(1, 2), (3, 4)])
14 + @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
15 | def test_csv_with_whitespace(param1, param2):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:19:26
   |
19 | @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
   |                          ^^^^^^^^^^^^^^^
20 | def test_csv_bad_quotes(param1, param2):
21 |     ...
   |
help: Use a `tuple` for the first argument
   |
18 |
   - @pytest.mark.parametrize("param1,param2", [(1, 2), (3, 4)])
19 + @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
20 | def test_csv_bad_quotes(param1, param2):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
  --> PT006.py:29:26
   |
29 | @pytest.mark.parametrize(("param1",), [1, 2, 3])
   |                          ^^^^^^^^^^^
30 | def test_tuple_one_elem(param1, param2):
31 |     ...
   |
help: Use a string for the first argument

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:34:26
   |
34 | @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)])
   |                          ^^^^^^^^^^^^^^^^^^^^
35 | def test_list(param1, param2):
36 |     ...
   |
help: Use a `tuple` for the first argument
   |
33 |
   - @pytest.mark.parametrize(["param1", "param2"], [(1, 2), (3, 4)])
34 + @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
35 | def test_list(param1, param2):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
  --> PT006.py:39:26
   |
39 | @pytest.mark.parametrize(["param1"], [1, 2, 3])
   |                          ^^^^^^^^^^
40 | def test_list_one_elem(param1, param2):
41 |     ...
   |
help: Use a string for the first argument

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:44:26
   |
44 | @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3])
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^
45 | def test_list_expressions(param1, param2):
46 |     ...
   |
help: Use a `tuple` for the first argument
   |
43 |
   - @pytest.mark.parametrize([some_expr, another_expr], [1, 2, 3])
44 + @pytest.mark.parametrize((some_expr, another_expr), [1, 2, 3])
45 | def test_list_expressions(param1, param2):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:49:26
   |
49 | @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3])
   |                          ^^^^^^^^^^^^^^^^^^^^^
50 | def test_list_mixed_expr_literal(param1, param2):
51 |     ...
   |
help: Use a `tuple` for the first argument
   |
48 |
   - @pytest.mark.parametrize([some_expr, "param2"], [1, 2, 3])
49 + @pytest.mark.parametrize((some_expr, "param2"), [1, 2, 3])
50 | def test_list_mixed_expr_literal(param1, param2):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:54:26
   |
54 | @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)])
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
55 | def test_implicit_str_concat_with_parens(param1, param2, param3):
56 |     ...
   |
help: Use a `tuple` for the first argument
   |
53 |
   - @pytest.mark.parametrize(("param1, " "param2, " "param3"), [(1, 2, 3), (4, 5, 6)])
54 + @pytest.mark.parametrize(("param1", "param2", "param3"), [(1, 2, 3), (4, 5, 6)])
55 | def test_implicit_str_concat_with_parens(param1, param2, param3):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:59:26
   |
59 | @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)])
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60 | def test_implicit_str_concat_no_parens(param1, param2, param3):
61 |     ...
   |
help: Use a `tuple` for the first argument
   |
58 |
   - @pytest.mark.parametrize("param1, " "param2, " "param3", [(1, 2, 3), (4, 5, 6)])
59 + @pytest.mark.parametrize(("param1", "param2", "param3"), [(1, 2, 3), (4, 5, 6)])
60 | def test_implicit_str_concat_no_parens(param1, param2, param3):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:64:26
   |
64 | @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)])
   |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65 | def test_implicit_str_concat_with_multi_parens(param1, param2, param3):
66 |     ...
   |
help: Use a `tuple` for the first argument
   |
63 |
   - @pytest.mark.parametrize((("param1, " "param2, " "param3")), [(1, 2, 3), (4, 5, 6)])
64 + @pytest.mark.parametrize(("param1", "param2", "param3"), [(1, 2, 3), (4, 5, 6)])
65 | def test_implicit_str_concat_with_multi_parens(param1, param2, param3):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:69:26
   |
69 | @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)])
   |                          ^^^^^^^^^^^^^^^^^
70 | def test_csv_with_parens(param1, param2):
71 |     ...
   |
help: Use a `tuple` for the first argument
   |
68 |
   - @pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)])
69 + @pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
70 | def test_csv_with_parens(param1, param2):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:74:39
   |
74 | parametrize = pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)])
   |                                       ^^^^^^^^^^^^^^^^^
75 |
76 | @parametrize
   |
help: Use a `tuple` for the first argument
   |
73 |
   - parametrize = pytest.mark.parametrize(("param1,param2"), [(1, 2), (3, 4)])
74 + parametrize = pytest.mark.parametrize(("param1", "param2"), [(1, 2), (3, 4)])
75 |
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `tuple`
  --> PT006.py:81:35
   |
81 | @pytest.mark.parametrize(argnames=("param1,param2"), argvalues=[(1, 2), (3, 4)])
   |                                   ^^^^^^^^^^^^^^^^^
82 | def test_keyword_arguments(param1, param2):
83 |     ...
   |
help: Use a `tuple` for the first argument
   |
80 |
   - @pytest.mark.parametrize(argnames=("param1,param2"), argvalues=[(1, 2), (3, 4)])
81 + @pytest.mark.parametrize(argnames=("param1", "param2"), argvalues=[(1, 2), (3, 4)])
82 | def test_keyword_arguments(param1, param2):
   |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
  --> PT006.py:86:26
   |
86 | @pytest.mark.parametrize(("param",), [(1,), (2,)])
   |                          ^^^^^^^^^^
87 | def test_single_element_tuple(param):
88 |     ...
   |
help: Use a string for the first argument
   |
85 |
   - @pytest.mark.parametrize(("param",), [(1,), (2,)])
86 + @pytest.mark.parametrize("param", [1, 2])
87 | def test_single_element_tuple(param):
   |

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
  --> PT006.py:91:26
   |
91 | @pytest.mark.parametrize(("param",), [[1], [2]])
   |                          ^^^^^^^^^^
92 | def test_single_element_list(param):
93 |     ...
   |
help: Use a string for the first argument
   |
90 |
   - @pytest.mark.parametrize(("param",), [[1], [2]])
91 + @pytest.mark.parametrize("param", [1, 2])
92 | def test_single_element_list(param):
   |

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
  --> PT006.py:96:26
   |
96 | @pytest.mark.parametrize(("param",), [[1], [2]])
   |                          ^^^^^^^^^^
97 | def test_single_element_list(param):
98 |     ...
   |
help: Use a string for the first argument
   |
95 |
   - @pytest.mark.parametrize(("param",), [[1], [2]])
96 + @pytest.mark.parametrize("param", [1, 2])
97 | def test_single_element_list(param):
   |

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
   --> PT006.py:103:5
    |
101 |   # Unsafe fix
102 |   @pytest.mark.parametrize(
103 | /     (
104 | |         # comment
105 | |         "param",
106 | |     ),
    | |_____^
107 |       [[1], [2]],
108 |   )
    |
help: Use a string for the first argument
    |
102 | @pytest.mark.parametrize(
    -     (
    -         # comment
    -         "param",
    -     ),
    -     [[1], [2]],
103 +     "param",
104 +     [1, 2],
105 | )
    |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
   --> PT006.py:114:5
    |
112 | # Unsafe fix
113 | @pytest.mark.parametrize(
114 |     ("param",),
    |     ^^^^^^^^^^
115 |     [
116 |         (
    |
help: Use a string for the first argument
    |
113 | @pytest.mark.parametrize(
    -     ("param",),
114 +     "param",
115 |     [
    -         (
    -             # comment
    -             1,
    -         ),
    -         (2,),
116 +         1,
117 +         2,
118 |     ],
    |
note: This is an unsafe fix and may change runtime behavior

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
   --> PT006.py:129:5
    |
127 | # Safe fix
128 | @pytest.mark.parametrize(
129 |     ("param",),
    |     ^^^^^^^^^^
130 |     [
131 |         (1,),
    |
help: Use a string for the first argument
    |
128 | @pytest.mark.parametrize(
    -     ("param",),
129 +     "param",
130 |     [
    -         (1,),
131 +         1,
132 |         # comment
    -         (2,),
133 +         2,
134 |     ],
    |

PT006 Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
   --> PT006.py:142:5
    |
140 | # A fix should be suggested for `argnames`, but not for `argvalues`.
141 | @pytest.mark.parametrize(
142 |     ("param",),
    |     ^^^^^^^^^^
143 |     [
144 |         (1,),
    |
help: Use a string for the first argument

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
   --> PT006.py:164:5
    |
162 | # See: https://github.com/astral-sh/ruff/issues/22441
163 | @pytest.mark.parametrize(
164 |     ["param"],
    |     ^^^^^^^^^
165 |     [
166 |         ((),),
    |
help: Use a string for the first argument
    |
163 | @pytest.mark.parametrize(
    -     ["param"],
164 +     "param",
165 |     [
    -         ((),),
    -         ((1,),),
166 +         (),
167 +         (1,),
168 |     ],
    |

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
   --> PT006.py:175:5
    |
174 | @pytest.mark.parametrize(
175 |     ["param"],
    |     ^^^^^^^^^
176 |     [
177 |         ((1, 2),),
    |
help: Use a string for the first argument
    |
174 | @pytest.mark.parametrize(
    -     ["param"],
175 +     "param",
176 |     [
    -         ((1, 2),),
    -         ((3, 4),),
177 +         (1, 2),
178 +         (3, 4),
179 |     ],
    |

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
   --> PT006.py:186:5
    |
185 | @pytest.mark.parametrize(
186 |     ["param"],
    |     ^^^^^^^^^
187 |     [
188 |         (((1,),),),
    |
help: Use a string for the first argument
    |
185 | @pytest.mark.parametrize(
    -     ["param"],
186 +     "param",
187 |     [
    -         (((1,),),),
188 +         ((1,),),
189 |     ],
    |

PT006 [*] Wrong type passed to first argument of `pytest.mark.parametrize`; expected `str`
   --> PT006.py:196:5
    |
195 | @pytest.mark.parametrize(
196 |     ["param"],
    |     ^^^^^^^^^
197 |     [
198 |         (((1,)),),
    |
help: Use a string for the first argument
    |
195 | @pytest.mark.parametrize(
    -     ["param"],
196 +     "param",
197 |     [
    -         (((1,)),),
198 +         (1,),
199 |     ],
    |
