def kudu_client(): """Provides a new Kudu client as a pytest fixture. The client only exists for the duration of the method it is used in. """ kudu_client = kudu_connect(KUDU_MASTER_HOST, KUDU_MASTER_PORT) try: yield kudu_client finally: try: kudu_client.close() except Exception as e: LOG.warn("Error closing Kudu client: %s", e)
def kudu_client(): """Provides a new Kudu client as a pytest fixture. The client only exists for the duration of the method it is used in. """ if "," in KUDU_MASTER_HOSTS: raise Exception("Multi-master not supported yet") if ":" in KUDU_MASTER_HOSTS: host, port = KUDU_MASTER_HOSTS.split(":") else: host, port = KUDU_MASTER_HOSTS, 7051 kudu_client = kudu_connect(host, port) try: yield kudu_client finally: try: kudu_client.close() except Exception as e: LOG.warn("Error closing Kudu client: %s", e)
def kudu_client(): """Provides a new Kudu client as a pytest fixture. The client only exists for the duration of the method it is used in. """ kudu_master = pytest.config.option.kudu_master_hosts if "," in kudu_master: raise Exception("Multi-master not supported yet") if ":" in kudu_master: host, port = kudu_master.split(":") else: host, port = kudu_master, DEFAULT_KUDU_MASTER_PORT kudu_client = kudu_connect(host, port) yield kudu_client try: kudu_client.close() except Exception as e: LOG.warn("Error closing Kudu client: %s", e)