def assert_raises_regexp(exception, reg, run, *args, **kwargs):
    __tracebackhide__ = True

    try:
        run(*args, **kwargs)
        assert False, "%s should have been thrown" % exception
    except exception:
        e = sys.exc_info()[1]
        p = re.compile(reg)
        assert p.search(str(e)), str(e)
Try to delete keypair by name.
dataset/ETHPy150Open pypa/pip/tests/lib/__init__.py/assert_raises_regexp--crossover with--dataset/ETHPy150Open dtroyer/python-openstackclient/functional/tests/compute/v2/test_keypair.py/KeypairBase.keypair_delete