Skip to content

Commit 0bf8d1d

Browse files
committed
Fix Ruff B007 fix Loop control variable not used within loop body
1 parent 2bb8bec commit 0bf8d1d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ ignore = [
242242
# like this so that we can reactivate them one by one. Alternatively ignored after further #
243243
# investigation if they are deemed to not make sense. #
244244
##################################################################################################
245-
"B007", # Loop control variable `result` not used within loop body
246245
"B008", # Do not perform function call `typer.Option` in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable
247246
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
248247
"B018", # Found useless attribute access. Either assign it to a variable or remove it.

tests/unit/sdk/test_batch.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
from __future__ import annotations
2+
3+
from typing import TYPE_CHECKING
4+
15
import pytest
2-
from pytest_httpx import HTTPXMock
36

47
from infrahub_sdk.exceptions import GraphQLError
58

9+
if TYPE_CHECKING:
10+
from pytest_httpx import HTTPXMock
11+
12+
from tests.unit.sdk.conftest import BothClients
13+
614

715
async def test_batch_return_exception(
8-
httpx_mock: HTTPXMock, mock_query_mutation_location_create_failed, mock_schema_query_01, clients
16+
httpx_mock: HTTPXMock, mock_query_mutation_location_create_failed, mock_schema_query_01, clients: BothClients
917
): # pylint: disable=unused-argument
1018
batch = await clients.standard.create_batch(return_exceptions=True)
1119
locations = ["JFK1", "JFK1"]
@@ -30,7 +38,7 @@ async def test_batch_return_exception(
3038

3139

3240
async def test_batch_exception(
33-
httpx_mock: HTTPXMock, mock_query_mutation_location_create_failed, mock_schema_query_01, clients
41+
httpx_mock: HTTPXMock, mock_query_mutation_location_create_failed, mock_schema_query_01, clients: BothClients
3442
): # pylint: disable=unused-argument
3543
batch = await clients.standard.create_batch(return_exceptions=False)
3644
locations = ["JFK1", "JFK1"]
@@ -40,11 +48,11 @@ async def test_batch_exception(
4048
batch.add(task=obj.save, node=obj)
4149

4250
with pytest.raises(GraphQLError) as exc:
43-
async for node, result in batch.execute():
51+
async for _, _ in batch.execute():
4452
pass
4553
assert "An error occurred while executing the GraphQL Query" in str(exc.value)
4654

4755

48-
async def test_batch_not_implemented_sync(clients):
56+
async def test_batch_not_implemented_sync(clients: BothClients):
4957
with pytest.raises(NotImplementedError):
5058
clients.sync.create_batch()

0 commit comments

Comments
 (0)