From d0f9b596f6d4e8fedee708ec7bfd94a60ac6619d Mon Sep 17 00:00:00 2001 From: Aron Radics Date: Fri, 7 Jun 2024 16:00:26 +0200 Subject: [PATCH 1/2] Fix failing tests --- elasticmock/fake_elasticsearch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticmock/fake_elasticsearch.py b/elasticmock/fake_elasticsearch.py index 62504e9..135665c 100644 --- a/elasticmock/fake_elasticsearch.py +++ b/elasticmock/fake_elasticsearch.py @@ -671,7 +671,7 @@ def search(self, index=None, doc_type=None, body=None, params=None, headers=None else: hits = sorted(hits, key=lambda k: k['_source'][key]) - if 'from' in body and 'size' in body and body['from'] + body['size'] > 0: + if body is not None and 'from' in body and 'size' in body and body['from'] + body['size'] > 0: hits = hits[body['from']:body['from'] + body['size']] if 'scroll' in params: From cdae972da5284f6afd6f0d7552bae68baf1ee55e Mon Sep 17 00:00:00 2001 From: Aron Radics Date: Fri, 7 Jun 2024 16:00:58 +0200 Subject: [PATCH 2/2] Add python 3.9 and 3.10 support, and drop 3.6 and 3.7 --- Makefile | 2 +- setup.py | 2 +- tox.ini | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a7bb654..714fdff 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -ELASTICMOCK_VERSION='2.3.0' +ELASTICMOCK_VERSION='3.0.0' install: pip install -r requirements.txt diff --git a/setup.py b/setup.py index 9cf3905..f31060b 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import setuptools -__version__ = '2.3.0' +__version__ = '3.0.0' # read the contents of your readme file from os import path diff --git a/tox.ini b/tox.ini index 64a1368..c247cac 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,14 @@ # content of: tox.ini , put in same dir as setup.py [tox] envlist = - py36-elasticsearch{1,2,5,6,7} - py37-elasticsearch{1,2,5,6,7} py38-elasticsearch{1,2,5,6,7} + py39-elasticsearch{1,2,5,6,7} + py310-elasticsearch{1,2,5,6,7} [testenv] deps = parameterized - pytest==4.6.9 + pytest==6.2.5 pytest-cov==2.8.1 elasticsearch1: elasticsearch ==1.9.0 elasticsearch2: elasticsearch >=2.0.0, <5.0.0