@@ -85,9 +85,9 @@ def test_deployment_is_fully_available_when_it_should_not(cl, client,
8585 None , None , None )
8686 watch .Watch .return_value = watcher
8787
88- with pytest .raises (ActivityFailed ) as excinfo :
88+ with pytest .raises (ActivityFailed ) as x :
8989 deployment_not_fully_available ("mysvc" )
90- assert "deployment 'mysvc' failed to stop running within" in str (excinfo )
90+ assert "deployment 'mysvc' failed to stop running within" in str (x . value )
9191
9292
9393@patch ('chaosk8s.has_local_config_file' , autospec = True )
@@ -104,18 +104,18 @@ def test_expecting_a_healthy_microservice_should_be_reported_when_not(cl,
104104 v1 .list_namespaced_deployment .return_value = result
105105 client .AppsV1beta1Api .return_value = v1
106106
107- with pytest .raises (ActivityFailed ) as excinfo :
107+ with pytest .raises (ActivityFailed ) as x :
108108 deployment_available_and_healthy ("mysvc" )
109- assert "Deployment 'mysvc' was not found" in str (excinfo )
109+ assert "Deployment 'mysvc' was not found" in str (x . value )
110110
111111 deployment = MagicMock ()
112112 deployment .spec .replicas = 2
113113 deployment .status .available_replicas = 1
114114 result .items .append (deployment )
115115
116- with pytest .raises (ActivityFailed ) as excinfo :
116+ with pytest .raises (ActivityFailed ) as x :
117117 deployment_available_and_healthy ("mysvc" )
118- assert "Deployment 'mysvc' is not healthy" in str (excinfo )
118+ assert "Deployment 'mysvc' is not healthy" in str (x . value )
119119
120120
121121@patch ('chaosk8s.has_local_config_file' , autospec = True )
@@ -157,9 +157,9 @@ def test_deployment_is_fully_available_when_it_should_not(cl, client,
157157 None , None , None )
158158 watch .Watch .return_value = watcher
159159
160- with pytest .raises (ActivityFailed ) as excinfo :
160+ with pytest .raises (ActivityFailed ) as x :
161161 deployment_not_fully_available ("mysvc" )
162- assert "deployment 'mysvc' failed to stop running within" in str (excinfo )
162+ assert "deployment 'mysvc' failed to stop running within" in str (x . value )
163163
164164
165165@patch ('chaosk8s.has_local_config_file' , autospec = True )
@@ -197,6 +197,6 @@ def test_deployment_is_not_fully_available_when_it_should(cl, client,
197197 None , None , None )
198198 watch .Watch .return_value = watcher
199199
200- with pytest .raises (ActivityFailed ) as excinfo :
200+ with pytest .raises (ActivityFailed ) as x :
201201 deployment_fully_available ("mysvc" )
202- assert "deployment 'mysvc' failed to recover within" in str (excinfo )
202+ assert "deployment 'mysvc' failed to recover within" in str (x . value )
0 commit comments