def get_cleanname(item):
    """Extract a test name from a pytest Function item."""
    if '[' in item.name:
        cleanname = item.name.split('[', 1)[1]
        cleanname = cleanname.split(']', 1)[0]
        return cleanname
    return item.name