16
16
# under the License.
17
17
18
18
import asyncio
19
+ import sys
19
20
from datetime import datetime , timedelta , timezone
20
21
from unittest .mock import MagicMock , call , patch
21
22
30
31
pytestmark = [pytest .mark .asyncio ]
31
32
32
33
34
+ async_bulk_xfail = pytest .mark .xfail (
35
+ sys .version_info < (3 , 11 ), reason = "Investigated in issue #62"
36
+ )
37
+
38
+
33
39
class AsyncMock (MagicMock ):
34
40
async def __call__ (self , * args , ** kwargs ):
35
41
return super (AsyncMock , self ).__call__ (* args , ** kwargs )
@@ -76,6 +82,7 @@ async def test_actions_remain_unchanged(self, async_client):
76
82
assert ok
77
83
assert [{"_id" : 1 }, {"_id" : 2 }] == actions
78
84
85
+ @async_bulk_xfail
79
86
async def test_all_documents_get_inserted (self , async_client ):
80
87
docs = [{"answer" : x , "_id" : x } for x in range (100 )]
81
88
async for ok , item in helpers .async_streaming_bulk (
@@ -88,6 +95,7 @@ async def test_all_documents_get_inserted(self, async_client):
88
95
"_source"
89
96
]
90
97
98
+ @async_bulk_xfail
91
99
async def test_documents_data_types (self , async_client ):
92
100
async def async_gen ():
93
101
for x in range (100 ):
@@ -306,6 +314,7 @@ async def test_bulk_works_with_single_item(self, async_client):
306
314
"_source"
307
315
]
308
316
317
+ @async_bulk_xfail
309
318
async def test_all_documents_get_inserted (self , async_client ):
310
319
docs = [{"answer" : x , "_id" : x } for x in range (100 )]
311
320
success , failed = await helpers .async_bulk (
@@ -319,6 +328,7 @@ async def test_all_documents_get_inserted(self, async_client):
319
328
"_source"
320
329
]
321
330
331
+ @async_bulk_xfail
322
332
async def test_stats_only_reports_numbers (self , async_client ):
323
333
docs = [{"answer" : x } for x in range (100 )]
324
334
success , failed = await helpers .async_bulk (
@@ -454,6 +464,7 @@ async def scan_teardown(async_client):
454
464
455
465
456
466
class TestScan (object ):
467
+ @async_bulk_xfail
457
468
async def test_order_can_be_preserved (self , async_client , scan_teardown ):
458
469
bulk = []
459
470
for x in range (100 ):
@@ -475,6 +486,7 @@ async def test_order_can_be_preserved(self, async_client, scan_teardown):
475
486
assert list (map (str , range (100 ))) == list (d ["_id" ] for d in docs )
476
487
assert list (range (100 )) == list (d ["_source" ]["answer" ] for d in docs )
477
488
489
+ @async_bulk_xfail
478
490
async def test_all_documents_are_read (self , async_client , scan_teardown ):
479
491
bulk = []
480
492
for x in range (100 ):
@@ -886,6 +898,7 @@ async def reindex_setup(async_client):
886
898
887
899
888
900
class TestReindex (object ):
901
+ @async_bulk_xfail
889
902
async def test_reindex_passes_kwargs_to_scan_and_bulk (
890
903
self , async_client , reindex_setup
891
904
):
@@ -907,6 +920,7 @@ async def test_reindex_passes_kwargs_to_scan_and_bulk(
907
920
await async_client .get (index = "prod_index" , id = 42 )
908
921
)["_source" ]
909
922
923
+ @async_bulk_xfail
910
924
async def test_reindex_accepts_a_query (self , async_client , reindex_setup ):
911
925
await helpers .async_reindex (
912
926
async_client ,
@@ -926,6 +940,7 @@ async def test_reindex_accepts_a_query(self, async_client, reindex_setup):
926
940
await async_client .get (index = "prod_index" , id = 42 )
927
941
)["_source" ]
928
942
943
+ @async_bulk_xfail
929
944
async def test_all_documents_get_moved (self , async_client , reindex_setup ):
930
945
await helpers .async_reindex (
931
946
async_client , "test_index" , "prod_index" , bulk_kwargs = {"refresh" : True }
@@ -976,6 +991,7 @@ async def reindex_data_stream_setup(async_client):
976
991
977
992
class TestAsyncDataStreamReindex (object ):
978
993
@pytest .mark .parametrize ("op_type" , [None , "create" ])
994
+ @async_bulk_xfail
979
995
async def test_reindex_index_datastream (
980
996
self , op_type , async_client , reindex_data_stream_setup
981
997
):
@@ -995,6 +1011,7 @@ async def test_reindex_index_datastream(
995
1011
]
996
1012
)
997
1013
1014
+ @async_bulk_xfail
998
1015
async def test_reindex_index_datastream_op_type_index (
999
1016
self , async_client , reindex_data_stream_setup
1000
1017
):
0 commit comments