Support for running different connection class in tests

This commit is contained in:
Honza Kral
2013-08-27 02:53:01 +02:00
parent 966128a5c8
commit 610226e91c
+5 -1
View File
@@ -85,7 +85,11 @@ def teardown():
class ElasticTestCase(TestCase):
def setUp(self):
self.client = Elasticsearch([os.environ['TEST_ES_SERVER']])
kw = {}
if 'TEST_ES_CONNECTION' in os.environ:
from elasticsearch import connection
kw['connection_class'] = getattr(connection, os.environ['TEST_ES_CONNECTION'])
self.client = Elasticsearch([os.environ['TEST_ES_SERVER']], **kw)
def tearDown(self):
self.client.indices.delete()