Skip to content
Closed
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
1 change: 1 addition & 0 deletions changelog/14795.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle non-tuple and non-list parameter items cleanly in :meth:`ParameterSet.extract_from` when single parameter names use trailing commas in :func:`pytest.mark.parametrize`.
9 changes: 3 additions & 6 deletions src/_pytest/mark/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,10 @@ def extract_from(
return parameterset
if force_tuple:
return cls.param(parameterset)
elif isinstance(parameterset, (tuple, list)):
return cls(parameterset, marks=[], id=None)
else:
# TODO: Refactor to fix this type-ignore. Currently the following
# passes type-checking but crashes:
#
# @pytest.mark.parametrize(('x', 'y'), [1, 2])
# def test_foo(x, y): pass
return cls(parameterset, marks=[], id=None) # type: ignore[arg-type]
return cls((parameterset,), marks=[], id=None)

@staticmethod
def _parse_parametrize_args(
Expand Down
Loading