Skip to content

Commit 68b7508

Browse files
pre-commit-ci[bot]kami619
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 421678f commit 68b7508

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

tests/workbenches/notebook-controller/test_custom_images.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class TestCustomImageValidation:
6060
), # Placeholder - update with sdg_hub image
6161
},
6262
id="sdg_hub_image",
63-
#marks=pytest.mark.skip(reason="Waiting for sdg_hub image URL from workbench image team"),
63+
# marks=pytest.mark.skip(reason="Waiting for sdg_hub image URL from workbench image team"),
6464
),
6565
# Test Case: Data Science Notebook (Demonstration of Pattern Reusability)
6666
# Image: Standard datascience workbench image
@@ -159,7 +159,7 @@ def test_custom_image_package_verification(
159159
else:
160160
# Default: basic Python packages
161161
packages_to_verify = ["sys", "os"]
162-
162+
163163
# Install packages if they're not standard library (not in the default list)
164164
standard_lib_packages = {"sys", "os"}
165165
packages_to_install = [pkg for pkg in packages_to_verify if pkg not in standard_lib_packages]
@@ -250,7 +250,7 @@ def _get_pod_failure_details(self, pod: Pod) -> str:
250250
f" Message: {message}"
251251
)
252252
else:
253-
details.append(f" Waiting Reason: {reason}\n" f" Message: {message}")
253+
details.append(f" Waiting Reason: {reason}\n Message: {message}")
254254

255255
# Check terminated state
256256
if hasattr(container_status.state, "terminated") and container_status.state.terminated:
@@ -271,9 +271,7 @@ def _get_pod_failure_details(self, pod: Pod) -> str:
271271

272272
return "\n".join(details)
273273

274-
def _format_package_failure_report(
275-
self, failed_packages: list[str], results: dict, pod: Pod
276-
) -> str:
274+
def _format_package_failure_report(self, failed_packages: list[str], results: dict, pod: Pod) -> str:
277275
"""
278276
Format a detailed error report for package import failures.
279277
@@ -298,7 +296,7 @@ def _format_package_failure_report(
298296
report.append(f" Execution Time: {result.execution_time_seconds:.2f}s")
299297

300298
if result.pod_logs:
301-
report.append(f" Pod Logs (excerpt):")
299+
report.append(" Pod Logs (excerpt):")
302300
# Show first 500 characters of logs
303301
log_excerpt = result.pod_logs[:500]
304302
for line in log_excerpt.split("\n"):
@@ -312,4 +310,4 @@ def _format_package_failure_report(
312310
report.append(" 3. Verify package names match import names (pip name vs import name)")
313311
report.append(" 4. Contact the workbench image team for package installation issues")
314312

315-
return "\n".join(report)
313+
return "\n".join(report)

tests/workbenches/utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
LOGGER = get_logger(name=__name__)
1414

15+
1516
@dataclass
1617
class PackageVerificationResult:
1718
"""Represents the outcome of package import verification for a single package."""
@@ -89,9 +90,7 @@ def verify_package_import(
8990
# Verify container exists
9091
container_names = [c.name for c in pod.instance.spec.containers]
9192
if container_name not in container_names:
92-
raise RuntimeError(
93-
f"Container '{container_name}' not found in pod. Available containers: {container_names}"
94-
)
93+
raise RuntimeError(f"Container '{container_name}' not found in pod. Available containers: {container_names}")
9594

9695
LOGGER.info(f"Verifying {len(packages)} packages in container '{container_name}' of pod '{pod.name}'")
9796

@@ -208,9 +207,7 @@ def install_packages_in_pod(
208207
# Verify container exists
209208
container_names = [c.name for c in pod.instance.spec.containers]
210209
if container_name not in container_names:
211-
raise RuntimeError(
212-
f"Container '{container_name}' not found in pod. Available containers: {container_names}"
213-
)
210+
raise RuntimeError(f"Container '{container_name}' not found in pod. Available containers: {container_names}")
214211

215212
LOGGER.info(f"Installing {len(packages)} packages in container '{container_name}' of pod '{pod.name}'")
216213

@@ -234,6 +231,7 @@ def install_packages_in_pod(
234231

235232
return results
236233

234+
237235
def get_username(dyn_client: DynamicClient) -> str | None:
238236
"""Gets the username for the client (see kubectl -v8 auth whoami)"""
239237
username: str | None

0 commit comments

Comments
 (0)