Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions test/test_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,9 @@ def greet(name):
with (
patch("gradio.history.resolve_token", return_value="tok"),
patch("gradio.history.HfApi", return_value=hub),
TestClient(app) as client,
):
yield TestClient(app), hub, io
yield client, hub, io
io.close()
close_all()

Expand Down Expand Up @@ -537,8 +538,9 @@ def workflow_app(tmp_path, monkeypatch):
with (
patch("gradio.history.resolve_token", return_value="tok"),
patch("gradio.history.HfApi", return_value=hub),
TestClient(app) as client,
):
yield TestClient(app), hub, wf, canvas._id
yield client, hub, wf, canvas._id
wf.close()
close_all()

Expand Down Expand Up @@ -636,8 +638,8 @@ def test_internal_dependencies_are_not_recorded(self, monkeypatch):
with (
patch("gradio.history.resolve_token", return_value="tok"),
patch("gradio.history.HfApi", return_value=hub),
TestClient(app) as client,
):
client = TestClient(app)
headers = {"X-Gradio-History-Bucket": "alice/hist"}
r = client.post(
f"/gradio_api/run/{internal._id}",
Expand Down
6 changes: 4 additions & 2 deletions test/test_queueing.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,10 @@ def tracking_create_task(coro, **kwargs):
heartbeat_tasks.append(task)
return task

with patch("gradio.routes.asyncio.create_task", side_effect=tracking_create_task):
test_client = TestClient(app)
with (
patch("gradio.routes.asyncio.create_task", side_effect=tracking_create_task),
TestClient(app) as test_client,
):
r = test_client.post(
f"{API_PREFIX}/queue/join",
json={
Expand Down
Loading