Skip to content

Commit 09b9ee9

Browse files
author
Andrei Neagu
committed
rename
1 parent be011ee commit 09b9ee9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

packages/service-library/tests/fastapi/long_running_tasks/test_long_running_tasks_context_manager.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545

4646

4747
async def _assert_task_removed(
48-
base_client: HttpClient, task_id: TaskId, router_prefix: str
48+
http_client: HttpClient, task_id: TaskId, router_prefix: str
4949
) -> None:
5050
with pytest.raises(GenericClientError, match=f"No task with {task_id} found"):
51-
await base_client.get_task_status(task_id)
51+
await http_client.get_task_status(task_id)
5252

5353

5454
async def a_test_task(progress: TaskProgress) -> int:
@@ -135,7 +135,7 @@ def mock_task_id() -> TaskId:
135135

136136

137137
@pytest.fixture()
138-
def base_client(bg_task_app: FastAPI, async_client: AsyncClient) -> HttpClient:
138+
def http_client(bg_task_app: FastAPI, async_client: AsyncClient) -> HttpClient:
139139
url = TypeAdapter(AnyHttpUrl).validate_python("http://backgroud.testserver.io/")
140140
return HttpClient(app=bg_task_app, async_client=async_client, base_url=f"{url}")
141141

@@ -149,33 +149,33 @@ async def _create_and_get_taskid(async_client: AsyncClient, *, endpoint: str) ->
149149

150150
async def test_task_result(
151151
async_client: AsyncClient,
152-
base_client: HttpClient,
152+
http_client: HttpClient,
153153
router_prefix: str,
154154
) -> None:
155155
task_id = await _create_and_get_taskid(async_client, endpoint="success")
156156

157157
async with periodic_task_result(
158-
base_client,
158+
http_client,
159159
task_id,
160160
task_timeout=10,
161161
status_poll_interval=TASK_SLEEP_INTERVAL / 3,
162162
) as result:
163163
assert result == 42
164164

165-
await _assert_task_removed(base_client, task_id, router_prefix)
165+
await _assert_task_removed(http_client, task_id, router_prefix)
166166

167167

168168
async def test_task_result_times_out(
169169
async_client: AsyncClient,
170-
base_client: HttpClient,
170+
http_client: HttpClient,
171171
router_prefix: str,
172172
) -> None:
173173
task_id = await _create_and_get_taskid(async_client, endpoint="success")
174174

175175
timeout = TASK_SLEEP_INTERVAL / 10
176176
with pytest.raises(TaskClientTimeoutError) as exec_info:
177177
async with periodic_task_result(
178-
base_client,
178+
http_client,
179179
task_id,
180180
task_timeout=timeout,
181181
status_poll_interval=TASK_SLEEP_INTERVAL / 3,
@@ -186,26 +186,26 @@ async def test_task_result_times_out(
186186
== f"Timed out after {timeout} seconds while awaiting '{task_id}' to complete"
187187
)
188188

189-
await _assert_task_removed(base_client, task_id, router_prefix)
189+
await _assert_task_removed(http_client, task_id, router_prefix)
190190

191191

192192
async def test_task_result_task_result_is_an_error(
193193
bg_task_app: FastAPI,
194194
async_client: AsyncClient,
195-
base_client: HttpClient,
195+
http_client: HttpClient,
196196
router_prefix: str,
197197
) -> None:
198198
task_id = await _create_and_get_taskid(async_client, endpoint="failing")
199199

200200
with pytest.raises(TaskExceptionError, match="I am failing as requested"):
201201
async with periodic_task_result(
202-
base_client,
202+
http_client,
203203
task_id,
204204
task_timeout=10,
205205
status_poll_interval=TASK_SLEEP_INTERVAL / 3,
206206
):
207207
pass
208-
await _assert_task_removed(base_client, task_id, router_prefix)
208+
await _assert_task_removed(http_client, task_id, router_prefix)
209209

210210

211211
@pytest.mark.parametrize("repeat", [1, 2, 10])

0 commit comments

Comments
 (0)