1515
1616def _find_sonobuoy ():
1717 """find sonobuoy in PATH, but also in a fixed location at ~/.local/bin to simplify use with Ansible"""
18- result = shutil .which (" sonobuoy" )
18+ result = shutil .which (' sonobuoy' )
1919 if result :
2020 return result
21- logger .debug (" sonobuoy not in PATH, trying $HOME/.local/bin" )
22- result = os .path .join (os .path .expanduser ("~" ), " .local" , " bin" , " sonobuoy" )
21+ logger .debug (' sonobuoy not in PATH, trying $HOME/.local/bin' )
22+ result = os .path .join (os .path .expanduser ('~' ), ' .local' , ' bin' , ' sonobuoy' )
2323 if os .path .exists (result ):
2424 return result
25- logger .debug (" sonobuoy executable not found; expect errors" )
25+ logger .debug (' sonobuoy executable not found; expect errors' )
2626
2727
2828def _fmt_result (counter ):
29- return ", " .join (
30- f"{ counter .get (key , 0 )} { key } " for key in ("passed" , "failed" , "skipped" )
31- )
29+ return ', ' .join (f"{ counter .get (key , 0 )} { key } " for key in ('passed' , 'failed' , 'skipped' ))
3230
3331
3432class SonobuoyHandler :
@@ -79,7 +77,7 @@ def _sonobuoy_delete(self):
7977 def _eval_result (self , counter ):
8078 """evaluate test results and return return code"""
8179 result_message = f"sonobuoy reports { _fmt_result (counter )} "
82- if counter [" failed" ]:
80+ if counter [' failed' ]:
8381 logger .error (result_message )
8482 return 3
8583 logger .info (result_message )
@@ -92,7 +90,7 @@ def _preflight_check(self):
9290 if not self .sonobuoy :
9391 raise RuntimeError ("sonobuoy executable not found; is it in PATH?" )
9492
95- def _sonobuoy_retrieve_result (self , plugin = " e2e" ):
93+ def _sonobuoy_retrieve_result (self , plugin = ' e2e' ):
9694 """
9795 Invoke sonobuoy to retrieve results and to store them in a subdirectory of
9896 the working directory. Analyze the results yaml file for given `plugin` and
@@ -103,7 +101,7 @@ def _sonobuoy_retrieve_result(self, plugin="e2e"):
103101 os .makedirs (result_dir , exist_ok = True )
104102
105103 self ._invoke_sonobuoy ("retrieve" , "-x" , result_dir )
106- yaml_path = os .path .join (result_dir , " plugins" , plugin , " sonobuoy_results.yaml" )
104+ yaml_path = os .path .join (result_dir , ' plugins' , plugin , ' sonobuoy_results.yaml' )
107105 logger .debug (f"parsing results from { yaml_path } " )
108106
109107 return sonobuoy_parse_result (plugin , yaml_path , self .sonobuoy_config )
0 commit comments