

@pytest.fixture(scope='module')
def rs_auth():
    global is_authorized, tried
    if ((not is_authorized) and (not tried)):
        if (not tried):
            try:
                conn = boto.connect_redshift()
            except boto.exception.NoAuthHandlerFound as e:
                pytest.skip(('authorization to access redshift cluster failed %s' % e))
            try:
                conn.authorize_cluster_security_group_ingress('default', cidrip=cidrip)
            except boto.redshift.exceptions.AuthorizationAlreadyExists:
                is_authorized = True
            except Exception as e:
                pytest.skip(('authorization to access redshift cluster failed %s' % e))
            else:
                is_authorized = True
            finally:
                tried = True
        else:
            pytest.skip('authorization to access redshift cluster failed')

dataset/ETHPy150Open blaze/odo/odo/backends/tests/test_s3_redshift.py rs_auth/original