from elasticsearch.helpers.test import get_test_client, ElasticsearchTestCase as BaseTestCase

client = None

def get_client():
    global client
    if client is not None:
        return client

    # try and locate manual override in the local environment
    try:
        from test_elasticsearch.local import get_client as local_get_client
        client = local_get_client()
    except ImportError:
        # fallback to using vanilla client
        client = get_test_client()

    return client


def setup():
    get_client()

class ElasticsearchTestCase(BaseTestCase):
    @staticmethod
    def _get_client():
        return get_client()

from elasticsearch.helpers.test import get_test_client, ElasticsearchTestCase as BaseTestCase

client = None

def get_client(**kwargs):
    global client
    if client is not None and not kwargs:
        return client

    # try and locate manual override in the local environment
    try:
        from test_elasticsearch.local import get_client as local_get_client
        new_client = local_get_client(**kwargs)
    except ImportError:
        # fallback to using vanilla client
        new_client = get_test_client(**kwargs)

    if not kwargs:
        client = new_client

    return new_client


def setup():
    get_client()

class ElasticsearchTestCase(BaseTestCase):
    @staticmethod
    def _get_client(**kwargs):
        return get_client(**kwargs)

Allow test client to be created with kwargs
Allow test client to be created with kwargs

  from elasticsearch.helpers.test import get_test_client, ElasticsearchTestCase as BaseTestCase
  
  client = None
  
- def get_client():
+ def get_client(**kwargs):
      global client
-     if client is not None:
+     if client is not None and not kwargs:
          return client
  
      # try and locate manual override in the local environment
      try:
          from test_elasticsearch.local import get_client as local_get_client
-         client = local_get_client()
+         new_client = local_get_client(**kwargs)
      except ImportError:
          # fallback to using vanilla client
-         client = get_test_client()
+         new_client = get_test_client(**kwargs)
  
+     if not kwargs:
+         client = new_client
+ 
-     return client
+     return new_client
  
  
  def setup():
      get_client()
  
  class ElasticsearchTestCase(BaseTestCase):
      @staticmethod
-     def _get_client():
+     def _get_client(**kwargs):
-         return get_client()
+         return get_client(**kwargs)
  
Allow test client to be created with kwargs
## Code Before:
from elasticsearch.helpers.test import get_test_client, ElasticsearchTestCase as BaseTestCase

client = None

def get_client():
    global client
    if client is not None:
        return client

    # try and locate manual override in the local environment
    try:
        from test_elasticsearch.local import get_client as local_get_client
        client = local_get_client()
    except ImportError:
        # fallback to using vanilla client
        client = get_test_client()

    return client


def setup():
    get_client()

class ElasticsearchTestCase(BaseTestCase):
    @staticmethod
    def _get_client():
        return get_client()

## Instruction:
Allow test client to be created with kwargs
## Code After:
from elasticsearch.helpers.test import get_test_client, ElasticsearchTestCase as BaseTestCase

client = None

def get_client(**kwargs):
    global client
    if client is not None and not kwargs:
        return client

    # try and locate manual override in the local environment
    try:
        from test_elasticsearch.local import get_client as local_get_client
        new_client = local_get_client(**kwargs)
    except ImportError:
        # fallback to using vanilla client
        new_client = get_test_client(**kwargs)

    if not kwargs:
        client = new_client

    return new_client


def setup():
    get_client()

class ElasticsearchTestCase(BaseTestCase):
    @staticmethod
    def _get_client(**kwargs):
        return get_client(**kwargs)
