Clears all mappers set up by SA and also clears all custom "id" and
    "slug" attributes inserted by the :func:`mapper` function in this module.

    This should only ever be needed in a testing context.

def clear_mappers():
    """
    Clears all mappers set up by SA and also clears all custom "id" and
    "slug" attributes inserted by the :func:`mapper` function in this module.

    This should only ever be needed in a testing context.
    """
    # Remove our hybrid property constructs.
    for mpr, is_primary in _mapper_registry.items():
        if is_primary:
            for attr_name in ('id', 'slug'):
                try:
                    attr = object.__getattribute__(mpr.class_, attr_name)
                    if isinstance(attr, hybrid_property):
                        if attr_name == 'id':
                            delattr(mpr.class_, attr_name)
                        else:
                            setattr(mpr.class_, attr_name, attr.descriptor)
                except AttributeError:
                    pass
    sa_clear_mappers()