File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
test_elasticsearch/test_dsl Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 3737from elasticsearch .exceptions import ConnectionError
3838from elasticsearch .helpers import bulk
3939
40- from ..utils import CA_CERTS
40+ from ..utils import CA_CERTS , wipe_cluster
4141from .test_integration ._async import test_document as async_document
4242from .test_integration ._sync import test_document as sync_document
4343from .test_integration .test_data import (
@@ -110,14 +110,16 @@ def _get_version(version_string: str) -> Tuple[int, ...]:
110110 return tuple (int (v ) if v .isdigit () else 999 for v in version )
111111
112112
113- @fixture ( scope = "session" )
113+ @fixture
114114def client (elasticsearch_url ) -> Elasticsearch :
115115 try :
116116 connection = get_test_client (
117117 elasticsearch_url , wait = "WAIT_FOR_ES" in os .environ
118118 )
119119 add_connection ("default" , connection )
120- return connection
120+ yield connection
121+ wipe_cluster (connection )
122+ connection .close ()
121123 except SkipTest :
122124 skip ()
123125
@@ -130,6 +132,7 @@ async def async_client(elasticsearch_url) -> AsyncGenerator[AsyncElasticsearch,
130132 )
131133 add_async_connection ("default" , connection )
132134 yield connection
135+ wipe_cluster (connection )
133136 await connection .close ()
134137 except SkipTest :
135138 skip ()
You can’t perform that action at this time.
0 commit comments