Revert "Support python 2.6"

This reverts commit 158f6e6183.
This commit is contained in:
Honza Kral
2013-08-28 19:02:42 +02:00
parent d306085789
commit d180e62a99
7 changed files with 17 additions and 19 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ class ElasticsearchTestCase(TestCase):
self.assertEquals(count, self.client.transport.call_count) self.assertEquals(count, self.client.transport.call_count)
def assert_url_called(self, method, url, count=1): def assert_url_called(self, method, url, count=1):
self.assertTrue((method, url) in self.client.transport.calls) self.assertIn((method, url), self.client.transport.calls)
calls = self.client.transport.calls[(method, url)] calls = self.client.transport.calls[(method, url)]
self.assertEquals(count, len(calls)) self.assertEquals(count, len(calls))
return calls return calls
@@ -35,7 +35,7 @@ class ElasticsearchTestCase(TestCase):
class TestElasticsearchTestCase(ElasticsearchTestCase): class TestElasticsearchTestCase(ElasticsearchTestCase):
def test_our_transport_used(self): def test_our_transport_used(self):
self.assertTrue(isinstance(self.client.transport, DummyTransport)) self.assertIsInstance(self.client.transport, DummyTransport)
def test_start_with_0_call(self): def test_start_with_0_call(self):
self.assert_call_count_equals(0) self.assert_call_count_equals(0)
+1 -2
View File
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from unittest import TestCase from unittest import TestCase, SkipTest
from nose import SkipTest
from elasticsearch.client.utils import _make_path from elasticsearch.client.utils import _make_path
+1 -1
View File
@@ -91,5 +91,5 @@ class TestConnectionPool(TestCase):
self.assertEquals(3, pool.dead_count[42]) self.assertEquals(3, pool.dead_count[42])
pool.mark_live(42) pool.mark_live(42)
self.assertFalse(42 in pool.dead_count) self.assertNotIn(42, pool.dead_count)
+1 -2
View File
@@ -8,8 +8,7 @@ import requests
from elasticsearch import Elasticsearch from elasticsearch import Elasticsearch
from elasticsearch.exceptions import ConnectionError from elasticsearch.exceptions import ConnectionError
from unittest import TestCase from unittest import SkipTest, TestCase
from nose import SkipTest
data_dir = None data_dir = None
@@ -6,7 +6,7 @@ clients.
from os import walk, environ from os import walk, environ
from os.path import exists, join, dirname, pardir from os.path import exists, join, dirname, pardir
import yaml import yaml
from nose import SkipTest from unittest import SkipTest
from . import ElasticTestCase from . import ElasticTestCase
@@ -53,7 +53,7 @@ class YamlTestCase(ElasticTestCase):
# resolve variables # resolve variables
if isinstance(value, (type(u''), type(''))) and value.startswith('$'): if isinstance(value, (type(u''), type(''))) and value.startswith('$'):
value = value[1:] value = value[1:]
self.assertTrue(value in self._state) self.assertIn(value, self._state)
value = self._state[value] value = self._state[value]
return value return value
@@ -67,10 +67,10 @@ class YamlTestCase(ElasticTestCase):
step = step.replace('\1', '.') step = step.replace('\1', '.')
if step.isdigit(): if step.isdigit():
step = int(step) step = int(step)
self.assertTrue(isinstance(value, list)) self.assertIsInstance(value, list)
self.assertTrue(len(value) > step) self.assertGreater(len(value), step)
else: else:
self.assertTrue(step in value) self.assertIn(step, value)
value = value[step] value = value[step]
return value return value
@@ -133,11 +133,11 @@ class YamlTestCase(ElasticTestCase):
def run_gt(self, action): def run_gt(self, action):
for key, value in action.items(): for key, value in action.items():
self.assertTrue(self._lookup(key) > value) self.assertGreater(self._lookup(key), value)
def run_lt(self, action): def run_lt(self, action):
for key, value in action.items(): for key, value in action.items():
self.assertTrue(self._lookup(key) < value) self.assertLess(self._lookup(key), value)
def run_set(self, action): def run_set(self, action):
for key, value in action.items(): for key, value in action.items():
@@ -5,7 +5,7 @@ from elasticsearch.transport import ADDRESS_RE
from . import ElasticTestCase from . import ElasticTestCase
from nose import SkipTest from unittest import SkipTest
class TestMemcachedConnection(ElasticTestCase): class TestMemcachedConnection(ElasticTestCase):
def setUp(self): def setUp(self):
+4 -4
View File
@@ -41,7 +41,7 @@ class TestTransport(TestCase):
def test_kwargs_passed_on_to_connection_pool(self): def test_kwargs_passed_on_to_connection_pool(self):
dt = object() dt = object()
t = Transport([{}], dead_timeout=dt) t = Transport([{}], dead_timeout=dt)
self.assertTrue(dt is t.connection_pool.dead_timeout) self.assertIs(dt, t.connection_pool.dead_timeout)
def test_custom_connection_class(self): def test_custom_connection_class(self):
class MyConnection(object): class MyConnection(object):
@@ -49,7 +49,7 @@ class TestTransport(TestCase):
self.kwargs = kwargs self.kwargs = kwargs
t = Transport([{}], connection_class=MyConnection) t = Transport([{}], connection_class=MyConnection)
self.assertEquals(1, len(t.connection_pool.connections)) self.assertEquals(1, len(t.connection_pool.connections))
self.assertTrue(isinstance(t.connection_pool.connections[0], MyConnection)) self.assertIsInstance(t.connection_pool.connections[0], MyConnection)
def test_add_connection(self): def test_add_connection(self):
t = Transport([{}], randomize_hosts=False) t = Transport([{}], randomize_hosts=False)
@@ -98,7 +98,7 @@ class TestTransport(TestCase):
t.sniff_hosts() t.sniff_hosts()
self.assertEquals(1, len(t.connection_pool.connections)) self.assertEquals(1, len(t.connection_pool.connections))
self.assertTrue(connection is t.get_connection()) self.assertIs(connection, t.get_connection())
def test_sniff_on_fail_triggers_sniffing_on_fail(self): def test_sniff_on_fail_triggers_sniffing_on_fail(self):
t = Transport([{'exception': ConnectionError('abandon ship')}, {"data": CLUSTER_NODES}], t = Transport([{'exception': ConnectionError('abandon ship')}, {"data": CLUSTER_NODES}],
@@ -115,7 +115,7 @@ class TestTransport(TestCase):
for _ in range(4): for _ in range(4):
t.perform_request('GET', '/') t.perform_request('GET', '/')
self.assertEquals(1, len(t.connection_pool.connections)) self.assertEquals(1, len(t.connection_pool.connections))
self.assertTrue(isinstance(t.get_connection(), DummyConnection)) self.assertIsInstance(t.get_connection(), DummyConnection)
t.last_sniff = time.time() - 5.1 t.last_sniff = time.time() - 5.1
t.perform_request('GET', '/') t.perform_request('GET', '/')