Skip to content

Commit

Permalink
Merge pull request #295 from lsst-sqre/tickets/DM-46034b
Browse files Browse the repository at this point in the history
DM-46034: Remove now-unnecessary `type: ignore` markers
  • Loading branch information
rra authored Aug 30, 2024
2 parents 1f77fd9 + f06ecfa commit 0d68d5a
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion safir/tests/dependencies/arq_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def abort_job(
except JobNotFound as e:
raise HTTPException(status_code=404, detail=str(e)) from e

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "http://example.com"
async with LifespanManager(app):
async with AsyncClient(transport=transport, base_url=base_url) as c:
Expand Down
2 changes: 1 addition & 1 deletion safir/tests/dependencies/db_session_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def get_list(
result = await session.scalars(select(User.username))
return list(result.all())

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "https://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get("/list")
Expand Down
6 changes: 3 additions & 3 deletions safir/tests/dependencies/gafaelfawr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def handler(
) -> dict[str, str]:
return {"user": user}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "https://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get("/")
Expand All @@ -50,7 +50,7 @@ async def handler(
) -> dict[str, str]:
return {"token": token}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "https://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get("/")
Expand Down Expand Up @@ -79,7 +79,7 @@ async def handler(
return {}

caplog.clear()
transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "https://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get("/", headers={"User-Agent": ""})
Expand Down
2 changes: 1 addition & 1 deletion safir/tests/dependencies/http_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def handler(
await http_client.get("https://www.google.com")
return {}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "https://example.com"
async with LifespanManager(app):
async with AsyncClient(transport=transport, base_url=base_url) as c:
Expand Down
4 changes: 2 additions & 2 deletions safir/tests/dependencies/logger_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def handler(
return {}

caplog.clear()
transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "http://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get(
Expand Down Expand Up @@ -69,7 +69,7 @@ async def handler(
return {}

caplog.clear()
transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "https://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get(
Expand Down
2 changes: 1 addition & 1 deletion safir/tests/fastapi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def address_error() -> dict[str, str]:
async def permission_error() -> dict[str, str]:
raise PermissionDeniedError("Permission denied")

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "https://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get("/user")
Expand Down
2 changes: 1 addition & 1 deletion safir/tests/middleware/ivoa_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def list_handler(
) -> dict[str, list[str]]:
return {"param": param}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "https://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get("/", params={"param": "foo"})
Expand Down
12 changes: 6 additions & 6 deletions safir/tests/middleware/x_forwarded_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def handler(request: Request) -> dict[str, str]:
assert request.url == "https://foo.example.com/"
return {}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "http://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get(
Expand All @@ -58,7 +58,7 @@ async def handler(request: Request) -> dict[str, str]:
assert request.url == "http://example.com/"
return {}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "http://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get(
Expand All @@ -84,7 +84,7 @@ async def handler(request: Request) -> dict[str, str]:
assert request.url == "http://example.com/"
return {}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "http://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get("/")
Expand All @@ -103,7 +103,7 @@ async def handler(request: Request) -> dict[str, str]:
assert request.url == "https://example.com/"
return {}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "http://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get(
Expand All @@ -129,7 +129,7 @@ async def handler(request: Request) -> dict[str, str]:
assert request.url == "https://example.com/"
return {}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "http://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get(
Expand All @@ -155,7 +155,7 @@ async def handler(request: Request) -> dict[str, str]:
assert request.url == "http://example.com/"
return {}

transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
base_url = "http://example.com"
async with AsyncClient(transport=transport, base_url=base_url) as client:
r = await client.get(
Expand Down
5 changes: 1 addition & 4 deletions safir/tests/slack/webhook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@ async def get_known() -> None:

# We need a custom HTTPX configuration to disable raising server
# exceptions so that we can inspect the resulting error handling.
transport = ASGITransport(
app=app, # type: ignore[arg-type]
raise_app_exceptions=False,
)
transport = ASGITransport(app=app, raise_app_exceptions=False)

# Run the test.
base_url = "https://example.com"
Expand Down
2 changes: 1 addition & 1 deletion safir/tests/uws/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def arq_queue() -> MockArqQueue:
@pytest_asyncio.fixture
async def client(app: FastAPI) -> AsyncIterator[AsyncClient]:
"""Return an ``httpx.AsyncClient`` configured to talk to the test app."""
transport = ASGITransport(app=app) # type: ignore[arg-type]
transport = ASGITransport(app=app)
async with AsyncClient(
transport=transport,
base_url="https://example.com/",
Expand Down
3 changes: 1 addition & 2 deletions safir/tests/uws/job_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,7 @@ async def test_redirects(
# Try various actions that result in redirects and ensure the redirect is
# correct.
async with AsyncClient(
transport=ASGITransport(app=app), # type: ignore[arg-type]
base_url="http://foo.com/",
transport=ASGITransport(app=app), base_url="http://foo.com/"
) as client:
r = await client.post(
"/test/jobs/1/destruction",
Expand Down

0 comments on commit 0d68d5a

Please sign in to comment.