def test_class_from_parent(request: FixtureRequest) -> None:
    """Ensure Class.from_parent can forward custom arguments to the constructor."""

    class MyCollector(pytest.Class):
        def __init__(self, name, parent, x):
            super().__init__(name, parent)
            self.x = x

        @classmethod
        def from_parent(cls, parent, *, name, x):  # type: ignore[override]
            return super().from_parent(parent=parent, name=name, x=x)

    collector = MyCollector.from_parent(parent=request.session, name="foo", x=10)
    assert collector.x == 10
Ensure Class.from_parent can forward custom arguments to the constructor.
testing/test_collection.py