Skip to content

Commit 97ffb96

Browse files
andravinclaude
andcommitted
fix(testing): deduplicate pytest marks when extracting tags
Prevents duplicate tags when the same marker is applied multiple times or through plugin interactions. Uses dict.fromkeys() to preserve order while deduplicating. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b25daee commit 97ffb96

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

python_files/vscode_pytest/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -818,12 +818,11 @@ def create_test_node(
818818
)
819819
absolute_test_id = get_absolute_test_id(test_case.nodeid, get_node_path(test_case))
820820

821-
# Extract pytest marks as tags
822-
tags: list[str] = []
823-
if hasattr(test_case, "own_markers"):
824-
for marker in test_case.own_markers:
825-
if marker.name and marker.name != "parametrize":
826-
tags.append(marker.name)
821+
# Extract pytest marks as tags (deduplicated, preserving order)
822+
tags: list[str] = list(dict.fromkeys(
823+
marker.name for marker in (getattr(test_case, "own_markers", None) or [])
824+
if marker.name and marker.name != "parametrize"
825+
))
827826

828827
return {
829828
"name": test_case.name,

0 commit comments

Comments
 (0)