File: __init__.py

package info (click to toggle)
python-elasticsearch 1.4.0-2~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 636 kB
  • sloc: python: 3,209; makefile: 155
file content (27 lines) | stat: -rw-r--r-- 645 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()