fix(lint): remove duplicate ImportError clauses and reformat files

Remove duplicate except ImportError blocks in cloud_resources_steps.py
(B025 violations in step_sandbox_create, step_sandbox_commit,
step_sandbox_rollback). Apply ruff format to 5 files flagged by the
format check.
This commit is contained in:
2026-05-29 15:19:15 -04:00
committed by Forgejo
parent 4f1bf3ef34
commit ff2c474c55
6 changed files with 17 additions and 36 deletions
+7 -7
View File
@@ -249,7 +249,7 @@ def step_import_error_raised(context: Any, text: str) -> None:
f"{context.raised_error}" # type: ignore[attr-defined]
)
msg = str(context.raised_error) # type: ignore[attr-defined]
assert text in msg, f"\'{text}\' not found in ImportError: {msg}"
assert text in msg, f"'{text}' not found in ImportError: {msg}"
@then("awssdk the session should be created successfully")
@@ -267,7 +267,7 @@ def step_session_created_with_profile(context: Any, profile: str) -> None:
mock_boto3: MagicMock = context.mock_boto3 # type: ignore[attr-defined]
call_kwargs = mock_boto3.Session.call_args[1]
assert call_kwargs.get("profile_name") == profile, (
f"Expected profile_name=\'{profile}\', got {call_kwargs}"
f"Expected profile_name='{profile}', got {call_kwargs}"
)
@@ -292,7 +292,7 @@ def step_bound_resource_slot(context: Any, slot_name: str) -> None:
br: BoundResource = context.bound_resource # type: ignore[attr-defined]
assert br.slot_name == slot_name, (
f"Expected slot_name=\'{slot_name}\', got \'{br.slot_name}\'"
f"Expected slot_name='{slot_name}', got '{br.slot_name}'"
)
@@ -303,7 +303,7 @@ def step_bound_resource_type(context: Any, resource_type: str) -> None:
br: BoundResource = context.bound_resource # type: ignore[attr-defined]
assert br.resource_type == resource_type, (
f"Expected resource_type=\'{resource_type}\', got \'{br.resource_type}\'"
f"Expected resource_type='{resource_type}', got '{br.resource_type}'"
)
@@ -315,7 +315,7 @@ def step_bound_resource_sandbox_path(context: Any, text: str) -> None:
br: BoundResource = context.bound_resource # type: ignore[attr-defined]
assert br.sandbox_path is not None, "Expected sandbox_path to be set"
assert text in br.sandbox_path, (
f"Expected \'{text}\' in sandbox_path=\'{br.sandbox_path}\'"
f"Expected '{text}' in sandbox_path='{br.sandbox_path}'"
)
@@ -327,7 +327,7 @@ def step_value_error_raised(context: Any, text: str) -> None:
f"{context.raised_error}" # type: ignore[attr-defined]
)
msg = str(context.raised_error) # type: ignore[attr-defined]
assert text in msg, f"\'{text}\' not found in ValueError: {msg}"
assert text in msg, f"'{text}' not found in ValueError: {msg}"
@then('awssdk a NotImplementedError should be raised mentioning "{text}"')
@@ -338,7 +338,7 @@ def step_not_implemented_raised(context: Any, text: str) -> None:
f"{context.raised_error}" # type: ignore[attr-defined]
)
msg = str(context.raised_error) # type: ignore[attr-defined]
assert text in msg, f"\'{text}\' not found in NotImplementedError: {msg}"
assert text in msg, f"'{text}' not found in NotImplementedError: {msg}"
@then("awssdk a NotImplementedError should be raised")