Skip to content

Commit e83ae77

Browse files
chore: Bump ruff from 0.12.12 to 0.13.0 (#780)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.12.12 to 0.13.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/astral-sh/ruff/releases">ruff's releases</a>.</em></p> <blockquote> <h2>0.13.0</h2> <h2>Release Notes</h2> <p>Check out the <a href="https://astral.sh/blog/ruff-v0.13.0">blog post</a> for a migration guide and overview of the changes!</p> <h3>Breaking changes</h3> <ul> <li> <p><strong>Several rules can now add <code>from __future__ import annotations</code> automatically</strong></p> <p><code>TC001</code>, <code>TC002</code>, <code>TC003</code>, <code>RUF013</code>, and <code>UP037</code> now add <code>from __future__ import annotations</code> as part of their fixes when the <code>lint.future-annotations</code> setting is enabled. This allows the rules to move more imports into <code>TYPE_CHECKING</code> blocks (<code>TC001</code>, <code>TC002</code>, and <code>TC003</code>), use PEP 604 union syntax on Python versions before 3.10 (<code>RUF013</code>), and unquote more annotations (<code>UP037</code>).</p> </li> <li> <p><strong>Full module paths are now used to verify first-party modules</strong></p> <p>Ruff now checks that the full path to a module exists on disk before categorizing it as a first-party import. This change makes first-party import detection more accurate, helping to avoid false positives on local directories with the same name as a third-party dependency, for example. See the <a href="https://docs.astral.sh/ruff/faq/#how-does-ruff-determine-which-of-my-imports-are-first-party-third-party-etc">FAQ section</a> on import categorization for more details.</p> </li> <li> <p><strong>Deprecated rules must now be selected by exact rule code</strong></p> <p>Ruff will no longer activate deprecated rules selected by their group name or prefix. As noted below, the two remaining deprecated rules were also removed in this release, so this won't affect any current rules, but it will still affect any deprecations in the future.</p> </li> <li> <p><strong>The deprecated macOS configuration directory fallback has been removed</strong></p> <p>Ruff will no longer look for a user-level configuration file at <code>~/Library/Application Support/ruff/ruff.toml</code> on macOS. This feature was deprecated in v0.5 in favor of using the <a href="https://specifications.freedesktop.org/basedir-spec/latest/">XDG specification</a> (usually resolving to <code>~/.config/ruff/ruff.toml</code>), like on Linux. The fallback and accompanying deprecation warning have now been removed.</p> </li> </ul> <h3>Removed Rules</h3> <p>The following rules have been removed:</p> <ul> <li><a href="https://docs.astral.sh/ruff/rules/pandas-df-variable-name"><code>pandas-df-variable-name</code></a> (<code>PD901</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/non-pep604-isinstance"><code>non-pep604-isinstance</code></a> (<code>UP038</code>)</li> </ul> <h3>Stabilization</h3> <p>The following rules have been stabilized and are no longer in preview:</p> <ul> <li><a href="https://docs.astral.sh/ruff/rules/airflow-dag-no-schedule-argument"><code>airflow-dag-no-schedule-argument</code></a> (<code>AIR002</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/airflow3-removal"><code>airflow3-removal</code></a> (<code>AIR301</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/airflow3-moved-to-provider"><code>airflow3-moved-to-provider</code></a> (<code>AIR302</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/airflow3-suggested-update"><code>airflow3-suggested-update</code></a> (<code>AIR311</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/airflow3-suggested-to-move-to-provider"><code>airflow3-suggested-to-move-to-provider</code></a> (<code>AIR312</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/long-sleep-not-forever"><code>long-sleep-not-forever</code></a> (<code>ASYNC116</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/f-string-number-format"><code>f-string-number-format</code></a> (<code>FURB116</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/os-symlink"><code>os-symlink</code></a> (<code>PTH211</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/generic-not-last-base-class"><code>generic-not-last-base-class</code></a> (<code>PYI059</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/redundant-none-literal"><code>redundant-none-literal</code></a> (<code>PYI061</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/pytest-raises-ambiguous-pattern"><code>pytest-raises-ambiguous-pattern</code></a> (<code>RUF043</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/unused-unpacked-variable"><code>unused-unpacked-variable</code></a> (<code>RUF059</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/useless-class-metaclass-type"><code>useless-class-metaclass-type</code></a> (<code>UP050</code>)</li> </ul> <p>The following behaviors have been stabilized:</p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md">ruff's changelog</a>.</em></p> <blockquote> <h2>0.13.0</h2> <p>Check out the <a href="https://astral.sh/blog/ruff-v0.13.0">blog post</a> for a migration guide and overview of the changes!</p> <h3>Breaking changes</h3> <ul> <li> <p><strong>Several rules can now add <code>from __future__ import annotations</code> automatically</strong></p> <p><code>TC001</code>, <code>TC002</code>, <code>TC003</code>, <code>RUF013</code>, and <code>UP037</code> now add <code>from __future__ import annotations</code> as part of their fixes when the <code>lint.future-annotations</code> setting is enabled. This allows the rules to move more imports into <code>TYPE_CHECKING</code> blocks (<code>TC001</code>, <code>TC002</code>, and <code>TC003</code>), use PEP 604 union syntax on Python versions before 3.10 (<code>RUF013</code>), and unquote more annotations (<code>UP037</code>).</p> </li> <li> <p><strong>Full module paths are now used to verify first-party modules</strong></p> <p>Ruff now checks that the full path to a module exists on disk before categorizing it as a first-party import. This change makes first-party import detection more accurate, helping to avoid false positives on local directories with the same name as a third-party dependency, for example. See the <a href="https://docs.astral.sh/ruff/faq/#how-does-ruff-determine-which-of-my-imports-are-first-party-third-party-etc">FAQ section</a> on import categorization for more details.</p> </li> <li> <p><strong>Deprecated rules must now be selected by exact rule code</strong></p> <p>Ruff will no longer activate deprecated rules selected by their group name or prefix. As noted below, the two remaining deprecated rules were also removed in this release, so this won't affect any current rules, but it will still affect any deprecations in the future.</p> </li> <li> <p><strong>The deprecated macOS configuration directory fallback has been removed</strong></p> <p>Ruff will no longer look for a user-level configuration file at <code>~/Library/Application Support/ruff/ruff.toml</code> on macOS. This feature was deprecated in v0.5 in favor of using the <a href="https://specifications.freedesktop.org/basedir-spec/latest/">XDG specification</a> (usually resolving to <code>~/.config/ruff/ruff.toml</code>), like on Linux. The fallback and accompanying deprecation warning have now been removed.</p> </li> </ul> <h3>Removed Rules</h3> <p>The following rules have been removed:</p> <ul> <li><a href="https://docs.astral.sh/ruff/rules/pandas-df-variable-name"><code>pandas-df-variable-name</code></a> (<code>PD901</code>)</li> <li><a href="https://docs.astral.sh/ruff/rules/non-pep604-isinstance"><code>non-pep604-isinstance</code></a> (<code>UP038</code>)</li> </ul> <h3>Stabilization</h3> <p>The following rules have been stabilized and are no longer in preview:</p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/astral-sh/ruff/commit/a1fdd66f10a045a574efb20e422868b21decda40"><code>a1fdd66</code></a> Bump 0.13.0 (<a href="https://redirect.github.com/astral-sh/ruff/issues/20336">#20336</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/8770b95509b7a5a3b23061d739e6260303613f55"><code>8770b95</code></a> [ty] introduce <code>DivergentType</code> (<a href="https://redirect.github.com/astral-sh/ruff/issues/20312">#20312</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/65982a1e14a15449ea0ed5cf66b7f9dea6d3e82c"><code>65982a1</code></a> [ty] Use 'unknown' specialization for upper bound on Self (<a href="https://redirect.github.com/astral-sh/ruff/issues/20325">#20325</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/57d1f7132dbac82e07f22560dbedba7cff1dadc4"><code>57d1f71</code></a> [ty] Simplify unions of enum literals and subtypes thereof (<a href="https://redirect.github.com/astral-sh/ruff/issues/20324">#20324</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/7a75702237e6f0bc605d3d8e9470c4ca9f37c69e"><code>7a75702</code></a> Ignore deprecated rules unless selected by exact code (<a href="https://redirect.github.com/astral-sh/ruff/issues/20167">#20167</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/9ca632c84fef6ecb7fc810cacb0df801c7949c70"><code>9ca632c</code></a> Stabilize adding future import via config option (<a href="https://redirect.github.com/astral-sh/ruff/issues/20277">#20277</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/64fe7d30a3ac9444eab1ed397c451b6c6e80bc6f"><code>64fe7d3</code></a> [<code>flake8-errmsg</code>] Stabilize extending <code>raw-string-in-exception</code> (<code>EM101</code>) to ...</li> <li><a href="https://github.com/astral-sh/ruff/commit/beeeb8d5c5c8dabea2b11b0b8ed0f3c12dbf22c7"><code>beeeb8d</code></a> Stabilize the remaining Airflow rules (<a href="https://redirect.github.com/astral-sh/ruff/issues/20250">#20250</a>)</li> <li><a href="https://github.com/astral-sh/ruff/commit/b6fca52855d01dd40904386f5b8a6d4a17caae11"><code>b6fca52</code></a> [<code>flake8-bugbear</code>] Stabilize support for non-context-manager calls in `assert...</li> <li><a href="https://github.com/astral-sh/ruff/commit/ac7f882c78db09700bf6bccefe0e9a27fb1696b9"><code>ac7f882</code></a> [<code>flake8-commas</code>] Stabilize support for trailing comma checks in type paramet...</li> <li>Additional commits viewable in <a href="https://github.com/astral-sh/ruff/compare/0.12.12...0.13.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ruff&package-manager=pip&previous-version=0.12.12&new-version=0.13.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- 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> Co-authored-by: Eran Kampf <205185+ekampf@users.noreply.github.com>
1 parent 2b0bcaa commit e83ae77

15 files changed

+70
-68
lines changed

app/api/tests/test_client_connectors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_connector_create_failure(
115115
],
116116
)
117117
with pytest.raises(
118-
GraphQLMutationError, match="connectorCreate mutation failed."
118+
GraphQLMutationError, match=r"connectorCreate mutation failed."
119119
):
120120
api_client.connector_create(connector_spec)
121121

@@ -284,6 +284,6 @@ def test_connector_delete_raises_if_unknown_error(
284284
],
285285
)
286286
with pytest.raises(
287-
GraphQLMutationError, match="connectorDelete mutation failed."
287+
GraphQLMutationError, match=r"connectorDelete mutation failed."
288288
):
289289
api_client.connector_delete("some-id")

app/api/tests/test_client_groups.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_group_create_failure(self, test_url, api_client, mocked_responses):
9797
)
9898
],
9999
)
100-
with pytest.raises(GraphQLMutationError, match="groupCreate mutation failed."):
100+
with pytest.raises(GraphQLMutationError, match=r"groupCreate mutation failed."):
101101
api_client.group_create(GroupSpec(name=name))
102102

103103
def test_group_update(self, test_url, api_client, mocked_responses):
@@ -151,7 +151,7 @@ def test_group_update_failure(self, test_url, api_client, mocked_responses):
151151
)
152152
],
153153
)
154-
with pytest.raises(GraphQLMutationError, match="groupUpdate mutation failed."):
154+
with pytest.raises(GraphQLMutationError, match=r"groupUpdate mutation failed."):
155155
api_client.group_update(GroupSpec(id="test-id", name=name))
156156

157157
def test_group_delete(self, test_url, api_client, mocked_responses):
@@ -225,5 +225,5 @@ def test_group_delete_raises_if_unknown_error(
225225
)
226226
],
227227
)
228-
with pytest.raises(GraphQLMutationError, match="groupDelete mutation failed."):
228+
with pytest.raises(GraphQLMutationError, match=r"groupDelete mutation failed."):
229229
api_client.group_delete("some-id")

app/api/tests/test_client_resource_access.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_resource_access_add_failure(self, test_url, api_client, mocked_response
8787
)
8888

8989
with pytest.raises(
90-
GraphQLMutationError, match="resourceAccessAdd mutation failed."
90+
GraphQLMutationError, match=r"resourceAccessAdd mutation failed."
9191
):
9292
api_client.resource_access_add(
9393
resource_id=resource_id,
@@ -219,7 +219,7 @@ def test_resource_access_remove_raises_if_unknown_error(
219219
)
220220

221221
with pytest.raises(
222-
GraphQLMutationError, match="resourceAccessRemove mutation failed."
222+
GraphQLMutationError, match=r"resourceAccessRemove mutation failed."
223223
):
224224
api_client.resource_access_remove(
225225
resource_id=resource_id, principal_id=principal_id

app/api/tests/test_client_resources.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def test_get_invalid_resource(
227227
)
228228
],
229229
)
230-
with pytest.raises(ValueError, match="Invalid Resource Type: InvalidResource"):
230+
with pytest.raises(ValueError, match=r"Invalid Resource Type: InvalidResource"):
231231
api_client.get_resource(resource.id)
232232

233233
def test_get_resource_with_invalid_b64_id_raises(
@@ -300,7 +300,7 @@ def test_resource_create_failure(
300300
],
301301
)
302302
with pytest.raises(
303-
GraphQLMutationError, match="resourceCreate mutation failed."
303+
GraphQLMutationError, match=r"resourceCreate mutation failed."
304304
):
305305
api_client.resource_create(
306306
resource_type=ResourceType.NETWORK,
@@ -602,6 +602,6 @@ def test_resource_delete_raises_if_unknown_error(
602602
],
603603
)
604604
with pytest.raises(
605-
GraphQLMutationError, match="resourceDelete mutation failed."
605+
GraphQLMutationError, match=r"resourceDelete mutation failed."
606606
):
607607
api_client.resource_delete("some-id")

app/handlers/tests/test_handlers_connector.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class TestTwingateConnectorDelete:
339339
def test_twingate_connector_delete_deletes_connector(
340340
self, get_connector_and_crd, kopf_handler_runner, mock_api_client
341341
):
342-
connector, crd = get_connector_and_crd(
342+
_connector, crd = get_connector_and_crd(
343343
status={"twingate_connector_create": {"success": True}}, with_id=True
344344
)
345345
kopf_handler_runner(twingate_connector_delete, crd, MagicMock())
@@ -348,14 +348,14 @@ def test_twingate_connector_delete_deletes_connector(
348348
def test_twingate_connector_delete_without_status_does_nothing(
349349
self, get_connector_and_crd, kopf_handler_runner, mock_api_client
350350
):
351-
connector, crd = get_connector_and_crd()
351+
_connector, crd = get_connector_and_crd()
352352
kopf_handler_runner(twingate_connector_delete, crd, MagicMock())
353353
mock_api_client.connector_delete.assert_not_called()
354354

355355
def test_twingate_connector_pod_reconciler_raises_if_ran_before_create(
356356
self, get_connector_and_crd, kopf_handler_runner, mock_api_client
357357
):
358-
connector, crd = get_connector_and_crd()
358+
_connector, crd = get_connector_and_crd()
359359
with pytest.raises(kopf.TemporaryError):
360360
kopf_handler_runner(twingate_connector_pod_reconciler, crd, MagicMock())
361361

@@ -368,7 +368,7 @@ def test_deployment_create(
368368
k8s_core_client_mock,
369369
k8s_apps_client_mock,
370370
):
371-
connector, crd = get_connector_and_crd(
371+
_connector, crd = get_connector_and_crd(
372372
status={"twingate_connector_create": {"success": True}}, with_id=True
373373
)
374374

@@ -385,7 +385,7 @@ def test_deployment_update_if_drift(
385385
k8s_core_client_mock,
386386
k8s_apps_client_mock,
387387
):
388-
connector, crd = get_connector_and_crd(
388+
_connector, crd = get_connector_and_crd(
389389
status={"twingate_connector_create": {"success": True}}, with_id=True
390390
)
391391

@@ -400,7 +400,7 @@ def test_deployment_no_update_if_no_drift(
400400
k8s_core_client_mock,
401401
k8s_apps_client_mock,
402402
):
403-
connector, crd = get_connector_and_crd(
403+
_connector, crd = get_connector_and_crd(
404404
status={"twingate_connector_create": {"success": True}}, with_id=True
405405
)
406406

@@ -433,7 +433,7 @@ def test_no_annotation(
433433
k8s_apps_client_mock,
434434
mock_get_image,
435435
):
436-
connector, crd = get_connector_and_crd(
436+
_connector, crd = get_connector_and_crd(
437437
spec_overrides=dict(image_policy=ConnectorImagePolicy()),
438438
status={"twingate_connector_create": {"success": True}},
439439
with_id=True,
@@ -455,7 +455,7 @@ def test_past_due_annotation(
455455
k8s_apps_client_mock,
456456
mock_get_image,
457457
):
458-
connector, crd = get_connector_and_crd(
458+
_connector, crd = get_connector_and_crd(
459459
spec_overrides=dict(image_policy=ConnectorImagePolicy()),
460460
status={"twingate_connector_create": {"success": True}},
461461
annotations={ANNOTATION_NEXT_VERSION_CHECK: "2000-01-01T00:00:00Z"},
@@ -479,7 +479,7 @@ def test_not_past_due_annotation(
479479
mock_get_image,
480480
):
481481
now = pendulum.now("UTC").start_of("minute")
482-
connector, crd = get_connector_and_crd(
482+
_connector, crd = get_connector_and_crd(
483483
spec_overrides=dict(image_policy=ConnectorImagePolicy()),
484484
status={"twingate_connector_create": {"success": True}},
485485
annotations={ANNOTATION_NEXT_VERSION_CHECK: str(now.add(minutes=1))},
@@ -507,7 +507,7 @@ def test_creates_deployment_if_doesnt_exist(
507507
mock_get_image,
508508
):
509509
now = pendulum.now("UTC").start_of("minute")
510-
connector, crd = get_connector_and_crd(
510+
_connector, crd = get_connector_and_crd(
511511
spec_overrides=dict(image_policy=ConnectorImagePolicy()),
512512
status={"twingate_connector_create": {"success": True}},
513513
annotations={ANNOTATION_NEXT_VERSION_CHECK: str(now.add(minutes=1))},

app/handlers/tests/test_handlers_resource_access.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_id_invalid_spec(self):
3434
access_crd.principal_external_ref = None
3535
access_crd.get_group_ref_object.return_value = None
3636
with pytest.raises(
37-
ValueError, match="Missing principal_id or principal_external_ref"
37+
ValueError, match=r"Missing principal_id or principal_external_ref"
3838
):
3939
get_principal_id(access_crd, None, MagicMock())
4040

@@ -94,7 +94,7 @@ def test_from_external_ref_returns_none(self, mock_api_client):
9494
mock_api_client.get_service_account_id.return_value = None
9595

9696
with pytest.raises(
97-
ValueError, match="Principal serviceAccount sa-name not found"
97+
ValueError, match=r"Principal serviceAccount sa-name not found"
9898
):
9999
get_principal_id(access_crd, None, mock_api_client)
100100

@@ -106,7 +106,7 @@ def test_from_external_ref_invalid_type_returns_none(self, mock_api_client):
106106
access_crd.principal_external_ref.type = "invalid"
107107
access_crd.principal_external_ref.name = "sa-name"
108108

109-
with pytest.raises(ValueError, match="Unknown principal type: invalid"):
109+
with pytest.raises(ValueError, match=r"Unknown principal type: invalid"):
110110
get_principal_id(access_crd, None, mock_api_client)
111111

112112
def test_from_external_ref_uses_created_status_principal_id(self):

app/handlers/tests/test_handlers_services.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def test_kubernetes_resource_type_annotation_without_tls_secret_annotation(
229229

230230
with pytest.raises(
231231
kopf.PermanentError,
232-
match="resource.twingate.com/tlsSecret annotation is not provided",
232+
match=r"resource.twingate.com/tlsSecret annotation is not provided",
233233
):
234234
service_to_twingate_resource(
235235
example_cluster_ip_gateway_service_body, "default"
@@ -242,7 +242,7 @@ def test_kubernetes_resource_type_annotation_without_k8s_secret_object(
242242

243243
with pytest.raises(
244244
kopf.PermanentError,
245-
match="Kubernetes Secret object: gateway-tls is missing.",
245+
match=r"Kubernetes Secret object: gateway-tls is missing.",
246246
):
247247
service_to_twingate_resource(
248248
example_cluster_ip_gateway_service_body, "default"
@@ -259,7 +259,7 @@ def test_kubernetes_resource_type_annotation_with_invalid_secret_type(
259259

260260
with pytest.raises(
261261
kopf.PermanentError,
262-
match="Kubernetes Secret object: gateway-tls type is invalid.",
262+
match=r"Kubernetes Secret object: gateway-tls type is invalid.",
263263
):
264264
service_to_twingate_resource(
265265
example_cluster_ip_gateway_service_body, "default"
@@ -276,7 +276,7 @@ def test_kubernetes_resource_type_annotation_without_ca_cert(
276276

277277
with pytest.raises(
278278
kopf.PermanentError,
279-
match="Kubernetes Secret object: gateway-tls is missing ca.crt.",
279+
match=r"Kubernetes Secret object: gateway-tls is missing ca.crt.",
280280
):
281281
service_to_twingate_resource(
282282
example_cluster_ip_gateway_service_body, "default"
@@ -295,7 +295,7 @@ def test_kubernetes_resource_type_annotation_with_invalid_ca_cert(
295295

296296
with pytest.raises(
297297
kopf.PermanentError,
298-
match="Kubernetes Secret object: gateway-tls ca.crt is invalid.",
298+
match=r"Kubernetes Secret object: gateway-tls ca.crt is invalid.",
299299
):
300300
service_to_twingate_resource(
301301
example_cluster_ip_gateway_service_body, "default"
@@ -383,7 +383,7 @@ def test_kubernetes_resource_when_load_balancer_ip_is_not_ready(
383383
),
384384
pytest.raises(
385385
kopf.TemporaryError,
386-
match="Kubernetes Service: kubernetes-gateway LoadBalancer is not ready.",
386+
match=r"Kubernetes Service: kubernetes-gateway LoadBalancer is not ready.",
387387
),
388388
):
389389
service_to_twingate_resource(

app/tests/test_crds_connector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ def test_deserialization_imagepolicy_fails_on_invalid_version_specifier(
109109
sample_connector_object_imagepolicy,
110110
):
111111
sample_connector_object_imagepolicy["spec"]["imagePolicy"]["version"] = "invalid"
112-
with pytest.raises(ValueError, match="Invalid version specifier"):
112+
with pytest.raises(ValueError, match=r"Invalid version specifier"):
113113
TwingateConnectorCRD(**sample_connector_object_imagepolicy)
114114

115115

116116
def test_deserialization_fails_on_invalid_schedule(sample_connector_object_imagepolicy):
117117
sample_connector_object_imagepolicy["spec"]["imagePolicy"]["schedule"] = (
118118
"100 2 * * *"
119119
)
120-
with pytest.raises(ValueError, match="Invalid schedule value"):
120+
with pytest.raises(ValueError, match=r"Invalid schedule value"):
121121
TwingateConnectorCRD(**sample_connector_object_imagepolicy)
122122

123123

@@ -163,7 +163,7 @@ def test_spec_get_image_w_imagepolicy_raises_if_no_match(
163163
"app.version_policy_providers.DockerhubVersionPolicyProvider.get_all_tags",
164164
return_value=["1.0.0", "latest"],
165165
),
166-
pytest.raises(ValueError, match="Could not find valid tag for"),
166+
pytest.raises(ValueError, match=r"Could not find valid tag for"),
167167
):
168168
crd.spec.get_image()
169169

app/tests/test_crds_resource.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_deserialization(sample_network_resource_object):
192192

193193

194194
def test_is_browser_shortcut_enabled_disallowed_on_wildcard_resource():
195-
with pytest.raises(ValueError, match="isBrowserShortcutEnabled"):
195+
with pytest.raises(ValueError, match=r"isBrowserShortcutEnabled"):
196196
TwingateResourceCRD(
197197
apiVersion="twingate.com/v1",
198198
kind="TwingateResource",
@@ -206,7 +206,7 @@ def test_is_browser_shortcut_enabled_disallowed_on_wildcard_resource():
206206

207207

208208
def test_resourceprotocols_validation():
209-
with pytest.raises(ValueError, match="ports can't be set"):
209+
with pytest.raises(ValueError, match=r"ports can't be set"):
210210
TwingateResourceCRD(
211211
apiVersion="twingate.com/v1",
212212
kind="TwingateResource",
@@ -222,7 +222,9 @@ def test_resourceprotocols_validation():
222222

223223

224224
def test_resourceprotocol_ports_validation():
225-
with pytest.raises(ValueError, match="Input should be less than or equal to 65535"):
225+
with pytest.raises(
226+
ValueError, match=r"Input should be less than or equal to 65535"
227+
):
226228
TwingateResourceCRD(
227229
apiVersion="twingate.com/v1",
228230
kind="TwingateResource",
@@ -239,7 +241,7 @@ def test_resourceprotocol_ports_validation():
239241
},
240242
)
241243

242-
with pytest.raises(ValueError, match="Input should be greater than or equal to 1"):
244+
with pytest.raises(ValueError, match=r"Input should be greater than or equal to 1"):
243245
TwingateResourceCRD(
244246
apiVersion="twingate.com/v1",
245247
kind="TwingateResource",
@@ -254,7 +256,7 @@ def test_resourceprotocol_ports_validation():
254256
)
255257

256258
with pytest.raises(
257-
ValueError, match="Start port value must be less or equal to end port value"
259+
ValueError, match=r"Start port value must be less or equal to end port value"
258260
):
259261
TwingateResourceCRD(
260262
apiVersion="twingate.com/v1",

app/tests/test_crds_resourceaccess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def test_deserialization_with_no_target_ref_fails_validation():
369369
"resourceRef": {"name": "foo", "namespace": "default"},
370370
},
371371
}
372-
with pytest.raises(ValueError, match="Missing principal"):
372+
with pytest.raises(ValueError, match=r"Missing principal"):
373373
TwingateResourceAccessCRD(**data)
374374

375375

0 commit comments

Comments
 (0)