mercredi 11 avril 2018

How to run elasticsearch python unit tests?

I am trying to run ElasticSearch python tests from official elasticsearch-py realease here : https://github.com/elastic/elasticsearch-py/tree/5.x

Actually, I have done all the steps mentionned into elasticsearch-py/test_elasticsearch/README.rst and it turns out that I can run Elasticsearch in a Container with success.

But so far running the tests is failing everytime. I have got 12 errors out of 124 runned tests and it looks like test_elasticsearch.test_connection.TestRequestsConnection is always failing due to :

AttributeError: 'Session' object has no attribute 'merge_environment_settings'.

What I have done so far is downloading the official Repo, export ES_VERSION=5.4 and then running ElasticSearch with ./start_elasticsearch.sh. After that I am able to navigate to localhost:9200 into my Web Browser.

Then I've changed TEST_ES_SERVER into 'localhost:9200' into elasticsearch5/helpers/test.py file.

I am running the tests using python setup.py test or python run_tests.py but here's what the console returns in both case :

No elasticsearch repo found...

........................./home/user/bin/git/elasticsearch-py/elasticsearch5/client/utils.py:47: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal quote_plus(_escape(p), b',*') for p in parts if p not in SKIP_IN_PATH)

.EE.EEE.E..EE.EE.EE................................................................................

ERROR: test_body_attached (test_elasticsearch.test_connection.TestRequestsConnection)

Traceback (most recent call last) :

File "/home/user/bin/git/elasticsearch-py/test_elasticsearch/test_connection.py", line 213, in test_body_attached

request = self._get_request(con, 'GET', '/', body='{"answer": 42}')

File "/home/user/bin/git/elasticsearch-py/test_elasticsearch/test_connection.py", line 75, in _get_request status, headers, data = connection.perform_request(*args, **kwargs)

File "/home/user/bin/git/elasticsearch-py/elasticsearch5/connection/http_requests.py", line 72, in perform_request

settings = self.session.merge_environment_settings(prepared_request.url, {}, None, None, None)

AttributeError: 'Session' object has no attribute merge_environment_settings'

Do you have any idea how I can make this work ? Locally at first.

Thanks and regards.

Aucun commentaire:

Enregistrer un commentaire