@@ -29,7 +29,7 @@ class plugin_slow_catching_exception_and_ignoring(Plugin):
2929 def check (self ):
3030 try :
3131 time .sleep (5 )
32- except :
32+ except Exception :
3333 pass
3434 return # ugly syntax to let us yield no results
3535 yield
@@ -46,7 +46,11 @@ def check(self):
4646 try :
4747 time .sleep (5 )
4848 except Exception as e :
49- yield Result (self , constants .ERROR , key = 'test' , msg = 'fail' , exception = str (e ))
49+ yield Result (
50+ self , constants .ERROR ,
51+ key = 'test' , msg = 'fail' ,
52+ exception = str (e )
53+ )
5054
5155 class plugin_slow_raising_exception (Plugin ):
5256 '''
@@ -58,7 +62,7 @@ class plugin_slow_raising_exception(Plugin):
5862 def check (self ):
5963 try :
6064 time .sleep (5 )
61- except :
65+ except Exception :
6266 raise Exception ("I didn't expect an exception to be thrown" )
6367
6468 class plugin_fast (Plugin ):
@@ -80,28 +84,38 @@ def check(self):
8084
8185 assert 7 == len (results .results )
8286
83- assert results .results [0 ].kw .get ('exception' ) == 'Health check test_plugins:plugin_slow_passing_exception_up cancelled after 1 sec'
87+ assert results .results [0 ].kw .get ('exception' ) == 'Health check' \
88+ ' test_plugins:plugin_slow_passing_exception_up' \
89+ ' cancelled after 1 sec'
8490 assert results .results [0 ].result == constants .ERROR
8591 assert not results .results [0 ].kw .get ('traceback' )
8692
87- assert results .results [1 ].kw .get ('exception' ) == 'Health check test_plugins:plugin_slow_catching_exception_and_ignoring cancelled after 1 sec'
93+ assert results .results [1 ].kw .get ('exception' ) == 'Health check' \
94+ ' test_plugins:plugin_slow_catching_exception_and_ignoring' \
95+ ' cancelled after 1 sec'
8896 assert results .results [1 ].result == constants .ERROR
8997 assert not results .results [1 ].kw .get ('traceback' )
9098
91- assert results .results [2 ].kw .get ('exception' ) == 'Health check test_plugins:plugin_slow_catching_exception_and_handling cancelled after 1 sec'
99+ assert results .results [2 ].kw .get ('exception' ) == 'Health check' \
100+ ' test_plugins:plugin_slow_catching_exception_and_handling' \
101+ ' cancelled after 1 sec'
92102 assert results .results [2 ].result == constants .ERROR
93103 assert results .results [2 ].kw .get ('msg' ) == 'fail'
94104 assert not results .results [2 ].kw .get ('traceback' )
95105
96- assert results .results [3 ].kw .get ('exception' )== 'Health check test_plugins:plugin_slow_catching_exception_and_handling cancelled after 1 sec'
106+ assert results .results [3 ].kw .get ('exception' ) == 'Health check' \
107+ ' test_plugins:plugin_slow_catching_exception_and_handling' \
108+ ' cancelled after 1 sec'
97109 assert results .results [3 ].result == constants .ERROR
98110 assert not results .results [3 ].kw .get ('traceback' )
99111
100- assert results .results [4 ].kw .get ('exception' ) == "I didn't expect an exception to be thrown"
112+ assert results .results [4 ].kw .get ('exception' ) == "I didn't expect an" \
113+ " exception to be thrown"
101114 assert results .results [4 ].result == constants .CRITICAL
102115 assert results .results [4 ].kw .get ('traceback' )
103116
104- assert results .results [5 ].kw .get ('exception' ) == 'Health check test_plugins:plugin_slow_raising_exception cancelled after 1 sec'
117+ assert results .results [5 ].kw .get ('exception' ) == 'Health check' \
118+ ' test_plugins:plugin_slow_raising_exception cancelled after 1 sec'
105119 assert results .results [5 ].result == constants .ERROR
106120 assert not results .results [5 ].kw .get ('traceback' )
107121
0 commit comments