production-derived-test-cases
Warn when pytest membership-contract cases are derived only from the first-party production collection.
Why
When exact eligibility or support membership is contractual, deriving cases from production lets a member change without an independent test oracle failing.
Fix
For contractual membership, define a literal expected table, assert the production collection equals it, and drive behavior from the expected table. Suppress the warning with rationale for an intentional dynamic sweep.
Examples
import pytestfrom app.models import ELIGIBLE_MODELS
@pytest.mark.parametrize("model", ELIGIBLE_MODELS)def test_model(model): assert build(model).tier == "priority"import pytestfrom app.models import ELIGIBLE_MODELS
EXPECTED_MODELS = ("a", "b")
def test_model_membership(): assert ELIGIBLE_MODELS == EXPECTED_MODELS
@pytest.mark.parametrize("model", EXPECTED_MODELS)def test_model(model): assert build(model).tier == "priority"