Skip test for different op types before 0.90.1

This commit is contained in:
Honza Král
2013-11-22 22:28:29 +01:00
parent 5f8c5322b0
commit 5ce42094c6
3 changed files with 18 additions and 15 deletions
@@ -91,6 +91,12 @@ def teardown():
os.kill(int(pid), 15)
server.wait()
ES_VERSION = None
def _get_version(version_string):
version = version_string.strip().split('.')
return tuple(int(v) if v.isdigit() else 999 for v in version)
class ElasticTestCase(TestCase):
client = None
def setUp(self):
@@ -105,3 +111,11 @@ class ElasticTestCase(TestCase):
except NotFoundError:
pass
@property
def es_version(self):
global ES_VERSION
if ES_VERSION is None:
version_string = self.client.info()['version']['number']
ES_VERSION = _get_version(version_string)
return ES_VERSION
+1 -15
View File
@@ -10,7 +10,7 @@ import yaml
from elasticsearch import TransportError
from ..test_cases import SkipTest
from . import ElasticTestCase
from . import ElasticTestCase, _get_version
# some params had to be changed in python, keep track of them so we can rename
# those in the tests accordingly
@@ -19,8 +19,6 @@ PARAMS_RENAMES = {
'from': 'from_',
}
ES_VERSION = None
# mapping from catch values to http status codes
CATCH_CODES = {
'missing': 404,
@@ -30,19 +28,7 @@ CATCH_CODES = {
class InvalidActionType(Exception):
pass
def _get_version(version_string):
version = version_string.strip().split('.')
return tuple(int(v) if v.isdigit() else 999 for v in version)
class YamlTestCase(ElasticTestCase):
@property
def es_version(self):
global ES_VERSION
if ES_VERSION is None:
version_string = self.client.info()['version']['number']
ES_VERSION = _get_version(version_string)
return ES_VERSION
def setUp(self):
super(YamlTestCase, self).setUp()
if hasattr(self, '_setup_code'):
@@ -1,6 +1,7 @@
from elasticsearch import helpers
from . import ElasticTestCase
from ..test_cases import SkipTest
class TestStreamingBulk(ElasticTestCase):
def test_all_documents_get_inserted(self):
@@ -29,6 +30,8 @@ class TestStreamingBulk(ElasticTestCase):
assert False, "exception should have been raised"
def test_different_op_types(self):
if self.es_version < (0, 90, 1):
raise SkipTest('update supported since 0.90.1')
self.client.index(index='i', doc_type='t', id=45, body={})
self.client.index(index='i', doc_type='t', id=42, body={})
docs = [