Skip to content

Commit 7ef1b71

Browse files
raballewclaude
andcommitted
fix: resolve lint violations and improve test coverage for helm-removal changes
Break long lines in kubectl_test.py to stay within 120 character limit and remove unused OutputCallback import in operations_test.py. Generated-By: Forge/20260416_161341_490145_52646d64 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3bd8ed3 commit 7ef1b71

2 files changed

Lines changed: 55 additions & 10 deletions

File tree

python/packages/jumpstarter-kubernetes/jumpstarter_kubernetes/cluster/kubectl_test.py

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,14 @@ async def test_get_cluster_info_invalid_json(self, mock_get_contexts):
452452
@patch("jumpstarter_kubernetes.cluster.kubectl.get_kubectl_contexts")
453453
async def test_get_cluster_info_context_not_found(self, mock_get_contexts):
454454
mock_get_contexts.return_value = [
455-
{"name": "other-context", "cluster": "other", "server": "https://other", "user": "u", "namespace": "default", "current": False}
455+
{
456+
"name": "other-context",
457+
"cluster": "other",
458+
"server": "https://other",
459+
"user": "u",
460+
"namespace": "default",
461+
"current": False,
462+
}
456463
]
457464

458465
result = await get_cluster_info("missing-context")
@@ -465,9 +472,18 @@ async def test_get_cluster_info_context_not_found(self, mock_get_contexts):
465472
@patch("jumpstarter_kubernetes.cluster.kubectl.get_kubectl_contexts")
466473
@patch("jumpstarter_kubernetes.cluster.kubectl.run_command")
467474
@patch("jumpstarter_kubernetes.cluster.kubectl.check_jumpstarter_installation")
468-
async def test_get_cluster_info_inaccessible_cluster(self, mock_check_jumpstarter, mock_run_command, mock_get_contexts):
475+
async def test_get_cluster_info_inaccessible_cluster(
476+
self, mock_check_jumpstarter, mock_run_command, mock_get_contexts
477+
):
469478
mock_get_contexts.return_value = [
470-
{"name": "test-context", "cluster": "test-cluster", "server": "https://test.example.com", "user": "test-user", "namespace": "default", "current": False}
479+
{
480+
"name": "test-context",
481+
"cluster": "test-cluster",
482+
"server": "https://test.example.com",
483+
"user": "test-user",
484+
"namespace": "default",
485+
"current": False,
486+
}
471487
]
472488
mock_run_command.return_value = (1, "", "connection refused")
473489

@@ -482,9 +498,18 @@ async def test_get_cluster_info_inaccessible_cluster(self, mock_check_jumpstarte
482498
@patch("jumpstarter_kubernetes.cluster.kubectl.get_kubectl_contexts")
483499
@patch("jumpstarter_kubernetes.cluster.kubectl.run_command")
484500
@patch("jumpstarter_kubernetes.cluster.kubectl.check_jumpstarter_installation")
485-
async def test_get_cluster_info_version_parse_failure(self, mock_check_jumpstarter, mock_run_command, mock_get_contexts):
501+
async def test_get_cluster_info_version_parse_failure(
502+
self, mock_check_jumpstarter, mock_run_command, mock_get_contexts
503+
):
486504
mock_get_contexts.return_value = [
487-
{"name": "test-context", "cluster": "test-cluster", "server": "https://test.example.com", "user": "test-user", "namespace": "default", "current": False}
505+
{
506+
"name": "test-context",
507+
"cluster": "test-cluster",
508+
"server": "https://test.example.com",
509+
"user": "test-user",
510+
"namespace": "default",
511+
"current": False,
512+
}
488513
]
489514
mock_run_command.return_value = (0, "not json", "")
490515
mock_check_jumpstarter.return_value = V1Alpha1JumpstarterInstance(installed=False)
@@ -497,9 +522,18 @@ async def test_get_cluster_info_version_parse_failure(self, mock_check_jumpstart
497522
@pytest.mark.asyncio
498523
@patch("jumpstarter_kubernetes.cluster.kubectl.get_kubectl_contexts")
499524
@patch("jumpstarter_kubernetes.cluster.kubectl.run_command")
500-
async def test_get_cluster_info_version_command_runtime_error(self, mock_run_command, mock_get_contexts):
525+
async def test_get_cluster_info_version_command_runtime_error(
526+
self, mock_run_command, mock_get_contexts
527+
):
501528
mock_get_contexts.return_value = [
502-
{"name": "test-context", "cluster": "test-cluster", "server": "https://test.example.com", "user": "test-user", "namespace": "default", "current": False}
529+
{
530+
"name": "test-context",
531+
"cluster": "test-cluster",
532+
"server": "https://test.example.com",
533+
"user": "test-user",
534+
"namespace": "default",
535+
"current": False,
536+
}
503537
]
504538
mock_run_command.side_effect = RuntimeError("command failed")
505539

@@ -578,8 +612,20 @@ async def test_list_clusters_custom_parameters(self, mock_get_contexts):
578612
@patch("jumpstarter_kubernetes.cluster.kubectl.get_cluster_info")
579613
async def test_list_clusters_with_type_filter(self, mock_get_cluster_info, mock_get_contexts):
580614
mock_get_contexts.return_value = [
581-
{"name": "kind-ctx", "cluster": "kind-cluster", "server": "https://kind", "user": "u", "current": True},
582-
{"name": "remote-ctx", "cluster": "remote-cluster", "server": "https://remote", "user": "u", "current": False},
615+
{
616+
"name": "kind-ctx",
617+
"cluster": "kind-cluster",
618+
"server": "https://kind",
619+
"user": "u",
620+
"current": True,
621+
},
622+
{
623+
"name": "remote-ctx",
624+
"cluster": "remote-cluster",
625+
"server": "https://remote",
626+
"user": "u",
627+
"current": False,
628+
},
583629
]
584630

585631
kind_info = V1Alpha1ClusterInfo(

python/packages/jumpstarter-kubernetes/jumpstarter_kubernetes/cluster/operations_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ async def test_create_cluster_and_install_force_recreate_confirmed(
186186

187187
@pytest.mark.asyncio
188188
async def test_create_cluster_and_install_force_recreate_cancelled(self):
189-
from jumpstarter_kubernetes.callbacks import OutputCallback
190189
from jumpstarter_kubernetes.exceptions import ClusterOperationError
191190

192191
class RejectingCallback:

0 commit comments

Comments
 (0)