def random_msgpack_implementation(monkeypatch, request):
    """Randomly set the MsgPackSerializer implementation to JSONMsgPack."""
    import random

    from pdm.models import serializers

    if "msgpack" not in request.keywords and random.random() < 0.5:
        monkeypatch.setattr(serializers.MsgPackSerializer, "implementation", serializers.JSONMsgPack)
Randomly set the MsgPackSerializer implementation to JSONMsgPack.
tests/conftest.py