@@ -182,15 +182,8 @@ def write_client(client):
182
182
183
183
184
184
@pytest_asyncio .fixture
185
- async def async_write_client (async_client ):
185
+ async def async_write_client (write_client , async_client ):
186
186
yield async_client
187
- for index_name in await async_client .indices .get (
188
- index = "test-*" , expand_wildcards = "all"
189
- ):
190
- await async_client .indices .delete (index = index_name )
191
- await async_client .options (ignore_status = 404 ).indices .delete_template (
192
- name = "test-template"
193
- )
194
187
195
188
196
189
@fixture
@@ -443,18 +436,16 @@ def aggs_data():
443
436
}
444
437
445
438
446
- @fixture
447
- def pull_request (write_client ):
448
- sync_document .PullRequest .init ()
449
- pr = sync_document .PullRequest (
439
+ def make_pr (pr_module ):
440
+ return pr_module .PullRequest (
450
441
_id = 42 ,
451
442
comments = [
452
- sync_document .Comment (
443
+ pr_module .Comment (
453
444
content = "Hello World!" ,
454
- author = sync_document .User (name = "honzakral" ),
445
+ author = pr_module .User (name = "honzakral" ),
455
446
created_at = datetime (2018 , 1 , 9 , 10 , 17 , 3 , 21184 ),
456
447
history = [
457
- sync_document .History (
448
+ pr_module .History (
458
449
timestamp = datetime (2012 , 1 , 1 ),
459
450
diff = "-Ahoj Svete!\n +Hello World!" ,
460
451
)
@@ -463,30 +454,19 @@ def pull_request(write_client):
463
454
],
464
455
created_at = datetime (2018 , 1 , 9 , 9 , 17 , 3 , 21184 ),
465
456
)
457
+
458
+ @fixture
459
+ def pull_request (write_client ):
460
+ sync_document .PullRequest .init ()
461
+ pr = make_pr (sync_document )
466
462
pr .save (refresh = True )
467
463
return pr
468
464
469
465
470
466
@pytest_asyncio .fixture
471
467
async def async_pull_request (async_write_client ):
472
468
await async_document .PullRequest .init ()
473
- pr = async_document .PullRequest (
474
- _id = 42 ,
475
- comments = [
476
- async_document .Comment (
477
- content = "Hello World!" ,
478
- author = async_document .User (name = "honzakral" ),
479
- created_at = datetime (2018 , 1 , 9 , 10 , 17 , 3 , 21184 ),
480
- history = [
481
- async_document .History (
482
- timestamp = datetime (2012 , 1 , 1 ),
483
- diff = "-Ahoj Svete!\n +Hello World!" ,
484
- )
485
- ],
486
- ),
487
- ],
488
- created_at = datetime (2018 , 1 , 9 , 9 , 17 , 3 , 21184 ),
489
- )
469
+ pr = make_pr (async_document )
490
470
await pr .save (refresh = True )
491
471
return pr
492
472
0 commit comments