Skip to content

Pytest parametrized case run gutter icon

This feature adds run gutter icons for individual pytest.mark.parametrize cases.

How to use it

Put each parametrized case on its own line, then use the gutter run icon beside the case to run only that pytest node. The regular run icon beside the test function remains available for running all of its cases, so you can switch between the whole test and an individual case.

import pytest

@pytest.mark.parametrize("value", [
    "admin",
    "guest",
])
def test_role(value):
    assert value
test_roles.py::test_role[guest]

Notes

  • The line marker appears only when BetterPy can infer the exact pytest case ID.
  • Explicit ids from ids=[...] and pytest.param(..., id="...") are supported.
  • IDs inferred from structured values such as tuples, lists, and dictionaries are normalized to the node IDs pytest uses.
  • The marker follows the configured python_files, python_classes, python_functions, and testpaths collection rules, including inherited test methods and explicit-path runs.
  • The feature is gated by the Pytest parametrized case run gutter icon setting under Settings | BetterPy | Testing (Pytest) | Parametrize.