Skip to content

Commit dee21a6

Browse files
committed
checked convoluted exit
Signed-off-by: Katharina Trentau <[email protected]>
1 parent 72c0708 commit dee21a6

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Tests/kaas/k8s-default-storage-class/helper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ def initialize_logging():
1919

2020
def print_usage(file=sys.stderr):
2121
"""Help output"""
22-
print("""Usage: k8s_storageclass_check.py [options]
22+
print(
23+
"""Usage: k8s_storageclass_check.py [options]
2324
This tool checks the requested k8s default storage class according to the SCS Standard 0211 "kaas-default-storage-class".
2425
Options:
2526
[-k/--kubeconfig PATH_TO_KUBECONFIG] sets kubeconfig file to access kubernetes api
2627
[-d/--debug] enables DEBUG logging channel
27-
""",end='',file=file)
28+
""",
29+
end="",
30+
file=file,
31+
)
2832

2933

3034
class SCSTestException(Exception):

Tests/kaas/k8s-default-storage-class/k8s-default-storage-class-check.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@
2828
import sys
2929
import time
3030

31-
from helper import (SCSTestException, gen_sonobuoy_result_file,
32-
initialize_logging, print_usage, setup_k8s_client)
31+
from helper import (
32+
SCSTestException,
33+
gen_sonobuoy_result_file,
34+
initialize_logging,
35+
print_usage,
36+
setup_k8s_client,
37+
)
3338
from kubernetes import client
3439
from kubernetes.client.rest import ApiException
3540

@@ -193,9 +198,9 @@ def __init__(self, kubeconfig):
193198

194199
def prepare(self):
195200
"""
196-
Sets up k8s client in preparation of the testing.
197-
Checks whether the test pod and/or pvc already exists in the test namespace.
198-
If so, it returns True indecating cleanup has to be executed first.
201+
Sets up k8s client in preparation of the testing.
202+
Checks whether the test pod and/or pvc already exists in the test namespace.
203+
If so, it returns True indecating cleanup has to be executed first.
199204
"""
200205
try:
201206
logger.debug("setup_k8s_client(kubeconfig)")
@@ -268,7 +273,9 @@ def __exit__(self, exc_type, exc_value, traceback):
268273
if isinstance(exc_value, SCSTestException):
269274
self.return_message = exc_value.args[0]
270275
self.return_code = exc_value.return_code
271-
logger.debug(f"SCSTestException occurred with return_code: {self.return_code}")
276+
logger.debug(
277+
f"SCSTestException occurred with return_code: {self.return_code}"
278+
)
272279
else:
273280
# No specific exception, handle normally
274281
logger.debug(f"Exiting the context with return_code: {self.return_code}")

0 commit comments

Comments
 (0)