1+ import asyncio
12import contextlib
23import re
34from collections .abc import AsyncGenerator , Callable , Iterable
@@ -114,14 +115,15 @@ async def test_setup_untag_response_is_identical_setup_doesnt_exist(
114115 tag = "totally_new_tag_for_migration_testing"
115116 api_key = ApiKey .SOME_USER
116117
117- original = await php_api .post (
118- "/setup/untag" ,
119- data = {"api_key" : api_key , "tag" : tag , "setup_id" : setup_id },
120- )
121-
122- new = await py_api .post (
123- f"/setup/untag?api_key={ api_key } " ,
124- json = {"setup_id" : setup_id , "tag" : tag },
118+ original , new = await asyncio .gather (
119+ php_api .post (
120+ "/setup/untag" ,
121+ data = {"api_key" : api_key , "tag" : tag , "setup_id" : setup_id },
122+ ),
123+ py_api .post (
124+ f"/setup/untag?api_key={ api_key } " ,
125+ json = {"setup_id" : setup_id , "tag" : tag },
126+ ),
125127 )
126128
127129 assert original .status_code == HTTPStatus .PRECONDITION_FAILED
@@ -142,14 +144,15 @@ async def test_setup_untag_response_is_identical_tag_doesnt_exist(
142144 tag = "totally_new_tag_for_migration_testing"
143145 api_key = ApiKey .SOME_USER
144146
145- original = await php_api .post (
146- "/setup/untag" ,
147- data = {"api_key" : api_key , "tag" : tag , "setup_id" : setup_id },
148- )
149-
150- new = await py_api .post (
151- f"/setup/untag?api_key={ api_key } " ,
152- json = {"setup_id" : setup_id , "tag" : tag },
147+ original , new = await asyncio .gather (
148+ php_api .post (
149+ "/setup/untag" ,
150+ data = {"api_key" : api_key , "tag" : tag , "setup_id" : setup_id },
151+ ),
152+ py_api .post (
153+ f"/setup/untag?api_key={ api_key } " ,
154+ json = {"setup_id" : setup_id , "tag" : tag },
155+ ),
153156 )
154157
155158 assert original .status_code == HTTPStatus .PRECONDITION_FAILED
@@ -223,14 +226,15 @@ async def test_setup_tag_response_is_identical_setup_doesnt_exist(
223226 tag = "totally_new_tag_for_migration_testing"
224227 api_key = ApiKey .SOME_USER
225228
226- original = await php_api .post (
227- "/setup/tag" ,
228- data = {"api_key" : api_key , "tag" : tag , "setup_id" : setup_id },
229- )
230-
231- new = await py_api .post (
232- f"/setup/tag?api_key={ api_key } " ,
233- json = {"setup_id" : setup_id , "tag" : tag },
229+ original , new = await asyncio .gather (
230+ php_api .post (
231+ "/setup/tag" ,
232+ data = {"api_key" : api_key , "tag" : tag , "setup_id" : setup_id },
233+ ),
234+ py_api .post (
235+ f"/setup/tag?api_key={ api_key } " ,
236+ json = {"setup_id" : setup_id , "tag" : tag },
237+ ),
234238 )
235239
236240 assert original .status_code == HTTPStatus .PRECONDITION_FAILED
@@ -253,15 +257,16 @@ async def test_setup_tag_response_is_identical_tag_already_exists(
253257 api_key = ApiKey .SOME_USER
254258
255259 async with temporary_tags (tags = [tag ], setup_id = setup_id , persist = True ):
256- original = await php_api .post (
257- "/setup/tag" ,
258- data = {"api_key" : api_key , "tag" : tag , "setup_id" : setup_id },
259- )
260-
261- # In Python, since PHP committed it, it's also there for Python test context
262- new = await py_api .post (
263- f"/setup/tag?api_key={ api_key } " ,
264- json = {"setup_id" : setup_id , "tag" : tag },
260+ # Both APIs can be tested in parallel since the tag is already persisted
261+ original , new = await asyncio .gather (
262+ php_api .post (
263+ "/setup/tag" ,
264+ data = {"api_key" : api_key , "tag" : tag , "setup_id" : setup_id },
265+ ),
266+ py_api .post (
267+ f"/setup/tag?api_key={ api_key } " ,
268+ json = {"setup_id" : setup_id , "tag" : tag },
269+ ),
265270 )
266271
267272 assert original .status_code == HTTPStatus .INTERNAL_SERVER_ERROR
0 commit comments