Skip to content

Conversation

@andravin
Copy link

Extract pytest marks (e.g., @pytest.mark.slow, @pytest.mark.integration) during test discovery and expose them as VS Code TestTags with IDs like "mark.slow", "mark.integration". This enables filtering tests by marks in the Test Explorer UI using @python-tests:mark.slow syntax.

Changes:

  • Add tags field to TestItem TypedDict in pytest plugin
  • Extract marks from test_case.own_markers in create_test_node()
  • Add tags field to DiscoveredTestItem TypeScript type
  • Create TestTag objects from marks in populateTestTree()

Fixes #20350

Extract pytest marks (e.g., @pytest.mark.slow, @pytest.mark.integration)
during test discovery and expose them as VS Code TestTags with IDs like
"mark.slow", "mark.integration". This enables filtering tests by
marks in the Test Explorer UI using @python-tests:mark.slow syntax.

Changes:
- Add tags field to TestItem TypedDict in pytest plugin
- Extract marks from test_case.own_markers in create_test_node()
- Add tags field to DiscoveredTestItem TypeScript type
- Create TestTag objects from marks in populateTestTree()

Fixes microsoft#20350

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@andravin
Copy link
Author

@microsoft-github-policy-service agree

@andravin
Copy link
Author

image

@andravin
Copy link
Author

Tested with v2026.0.0 because main has build issues.

As pictured in the above screenshot, I created test file with @pytest.mark.integration, @pytest.mark.slow, etc, and these appeared in the TEST EXPLORER filter as @python-tests:mark.integration, @python-tests:mark.slow, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add filter based on pytest marks to Test Explorer

1 participant