Skip to content

Commit

Permalink
chore: Bump ruff from 0.5.7 to 0.6.2 (#391)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eran Kampf <eran@ekampf.com>
  • Loading branch information
dependabot[bot] and ekampf authored Aug 25, 2024
1 parent 71209d7 commit 0c26ca3
Show file tree
Hide file tree
Showing 20 changed files with 53 additions and 53 deletions.
6 changes: 3 additions & 3 deletions app/api/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
register(ResourceFactory)


@pytest.fixture()
@pytest.fixture
def twingate_settings():
return TwingateOperatorSettings(
network="slug",
Expand All @@ -22,11 +22,11 @@ def twingate_settings():
)


@pytest.fixture()
@pytest.fixture
def api_client(twingate_settings):
return TwingateAPIClient(twingate_settings)


@pytest.fixture()
@pytest.fixture
def test_url():
return "https://slug.test.com/api/graphql/"
2 changes: 1 addition & 1 deletion app/api/tests/test_client_remote_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import responses


@pytest.fixture()
@pytest.fixture
def mock_resource_data():
return {"id": "1", "name": "My Cluster"}

Expand Down
2 changes: 1 addition & 1 deletion app/api/tests/test_client_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from app.crds import ResourceSpec


@pytest.fixture()
@pytest.fixture
def mock_resource_data():
return {
"id": "1",
Expand Down
2 changes: 1 addition & 1 deletion app/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import responses


@pytest.fixture()
@pytest.fixture
def mocked_responses():
with responses.RequestsMock() as rsps:
yield rsps
Expand Down
10 changes: 5 additions & 5 deletions app/handlers/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@
register(ConnectorFactory)


@pytest.fixture()
@pytest.fixture
def k8s_client_mock():
client_mock = MagicMock()
with patch("kubernetes.client.CoreV1Api") as k8sclient_mock:
k8sclient_mock.return_value = client_mock
yield client_mock


@pytest.fixture()
@pytest.fixture
def kopf_info_mock():
with patch("kopf.info") as m:
yield m


@pytest.fixture()
@pytest.fixture
def kopf_adopt_mock():
with patch("kopf.adopt") as m:
yield m


@pytest.fixture()
@pytest.fixture
def kopf_label_mock():
with patch("kopf.label") as m:
yield m
Expand All @@ -53,7 +53,7 @@ def kopf_label_mock():
)


@pytest.fixture()
@pytest.fixture
def kopf_handler_runner(
k8s_client_mock: MagicMock,
kopf_info_mock: MagicMock,
Expand Down
6 changes: 3 additions & 3 deletions app/handlers/tests/test_handlers_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def mock_connector_spec_get_image():
yield mock_get_image


@pytest.fixture()
@pytest.fixture
def mock_api_client():
api_client_instance = MagicMock()
with patch("app.handlers.handlers_connectors.TwingateAPIClient") as mock_api_client:
mock_api_client.return_value = api_client_instance
yield api_client_instance


@pytest.fixture()
@pytest.fixture
def get_connector_and_crd(connector_factory):
def get(*, spec_overrides=None, status=None, with_id=False, annotations=None):
annotations = annotations or {}
Expand Down Expand Up @@ -304,7 +304,7 @@ def test_old_pod_spec_is_deleted(


class TestTwingateConnectorPodReconciler_ImagePolicy:
@pytest.fixture()
@pytest.fixture
def mock_get_image(self):
with patch("app.crds.ConnectorSpec.get_image") as mock_get_image:
mock_get_image.return_value = "twingate/connector:test"
Expand Down
2 changes: 1 addition & 1 deletion app/handlers/tests/test_handlers_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
)


@pytest.fixture()
@pytest.fixture
def mock_api_client():
api_client_instance = MagicMock()
with patch("app.handlers.handlers_resource.TwingateAPIClient") as mock_api_client:
Expand Down
2 changes: 1 addition & 1 deletion app/handlers/tests/test_handlers_resource_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)


@pytest.fixture()
@pytest.fixture
def mock_api_client():
api_client_instance = MagicMock()
with patch(
Expand Down
4 changes: 2 additions & 2 deletions app/handlers/tests/test_handlers_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Ignore the fact we use _cogs here


@pytest.fixture()
@pytest.fixture
def example_service_body():
yaml_str = """
apiVersion: v1
Expand Down Expand Up @@ -45,7 +45,7 @@ def example_service_body():
return kopf.Body(yaml.safe_load(yaml_str))


@pytest.fixture()
@pytest.fixture
def k8s_customobjects_client_mock():
client_mock = MagicMock()
with patch("kubernetes.client.CustomObjectsApi") as k8sclient_mock:
Expand Down
4 changes: 2 additions & 2 deletions app/tests/test_crds_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from app.crds import TwingateConnectorCRD


@pytest.fixture()
@pytest.fixture
def sample_connector_object_image():
return {
"apiVersion": "twingate.com/v1beta",
Expand All @@ -30,7 +30,7 @@ def sample_connector_object_image():
}


@pytest.fixture()
@pytest.fixture
def sample_connector_object_imagepolicy():
return {
"apiVersion": "twingate.com/v1beta",
Expand Down
2 changes: 1 addition & 1 deletion app/tests/test_crds_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from app.crds import TwingateResourceCRD


@pytest.fixture()
@pytest.fixture
def sample_resource_object():
return {
"apiVersion": "twingate.com/v1",
Expand Down
6 changes: 3 additions & 3 deletions app/tests/test_crds_resourceaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
from app.crds import TwingateResourceAccessCRD, TwingateResourceCRD


@pytest.fixture()
@pytest.fixture
def mock_get_namespaced_custom_object():
with patch(
"kubernetes.client.CustomObjectsApi.get_namespaced_custom_object"
) as mock:
yield mock


@pytest.fixture()
@pytest.fixture
def sample_resource_object():
return {
"apiVersion": "twingate.com/v1",
Expand Down Expand Up @@ -99,7 +99,7 @@ def sample_resource_object():
}


@pytest.fixture()
@pytest.fixture
def sample_resourceaccess_object():
return {
"apiVersion": "twingate.com/v1",
Expand Down
2 changes: 1 addition & 1 deletion app/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from app.settings import TwingateOperatorSettings


@pytest.fixture()
@pytest.fixture
def mock_get_remote_network_by_name():
with patch("app.api.TwingateAPIClient.get_remote_network_by_name") as m:
yield m
Expand Down
4 changes: 2 additions & 2 deletions app/version_policy_providers/tests/test_dockerhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
from app.version_policy_providers.dockerhub import DockerhubVersionPolicyProvider


@pytest.fixture()
@pytest.fixture
def dockerhub_connector_provider(shared_datadir, mocked_responses):
content = (shared_datadir / "dockerhub_connector_tags_response.json").read_text()
provider = DockerhubVersionPolicyProvider()
mocked_responses.get(provider.tags_api_url, status=200, body=content)
return provider


@pytest.fixture()
@pytest.fixture
def dockerhub_operator_provider(shared_datadir, mocked_responses):
content = (shared_datadir / "dockerhub_operator_tags_response.json").read_text()
provider = DockerhubVersionPolicyProvider()
Expand Down
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def pytest_collection_modifyitems(session, config, items):
global_sequence = 0


@pytest.fixture()
@pytest.fixture
def sequential_number():
global global_sequence
yield global_sequence
Expand Down
40 changes: 20 additions & 20 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pytest-randomly = "^3.15.0"
pytest-sugar = "^1.0.0"
pyupgrade = "^3.17.0"
responses = "^0.25.3"
ruff = "^0.5.7"
ruff = "^0.6.2"
syrupy = "^4.6.4"
types-croniter = "^3.0.3.20240731"
types-requests = "^2.32.0.20240712"
Expand Down
2 changes: 1 addition & 1 deletion tests_integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def kopf_settings():
return settings


@pytest.fixture()
@pytest.fixture
def unique_resource_name(request):
return request.node.originalname.replace("_", "-") + "-" + str(uuid.uuid4())
4 changes: 2 additions & 2 deletions tests_integration/test_crds_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from tests_integration.utils import kubectl_create, kubectl_delete, kubectl_get


@pytest.fixture()
@pytest.fixture
def unique_connector_name(sequential_number, ci_run_number):
return f"conn-{ci_run_number}-{sequential_number}"


@pytest.mark.integration()
@pytest.mark.integration
class TestConnectorCRD:
def test_no_image_or_imagepolicy(self, unique_connector_name):
result = kubectl_create(
Expand Down
2 changes: 1 addition & 1 deletion tests_integration/test_crds_resourceaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tests_integration.utils import kubectl_create, kubectl_delete


@pytest.fixture()
@pytest.fixture
def unique_access_name(sequential_number, ci_run_number):
unique_name = f"acc-{ci_run_number}-{sequential_number}"
yield unique_name
Expand Down

0 comments on commit 0c26ca3

Please sign in to comment.