Skip to content
Snippets Groups Projects
Commit a26f754d authored by jan.bednarik's avatar jan.bednarik
Browse files

Cleanup test_* indices on teardown.

parent cf4338ca
No related branches found
No related tags found
No related merge requests found
......@@ -60,3 +60,7 @@ variable `ELASTICSEARCH_DSN`. E.g.
### Testing
Run: `pytest`
Expects Elasticsearch for tests running on `localhost:9200` (can be override by
environment variable `ELASTICSEARCH_DSN`). Tests creates random indices with
prefix `test_` and deletes all indices matching `test_*` on teardown.
......@@ -10,7 +10,8 @@ def es():
"""Elasticsearch client."""
es_dsn = os.environ.get('ELASTICSEARCH_DSN', 'http://localhost:9200')
es_client = Elasticsearch(es_dsn)
return es_client
yield es_client
es_client.indices.delete('test_*')
@pytest.fixture
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment