def pytest_err_msg(err):
    """Get the error message from an exception that pytest catches

    Compatibility function for newer versions of pytest, where ``str(err)``
    no longer returns the expected ``__repr__`` of an exception.
    """
    try:
        return str(err.value)
    except AttributeError:
        return str(err)