Skip to content

Commit cb77bc1

Browse files
committed
Fix pytest calls
Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
1 parent c39ebdd commit cb77bc1

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
requests-mock
22
coverage
33
pycodestyle
4-
pytest>=2.8
4+
pytest>=6.0
55
pytest-cov
66
pytest-sugar

tests/test_deployment.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)