Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test reliability by cleaning the state pollution of test_warning in TestMainView #305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def check_status(self):
assert response['content-type'] == 'text/html; charset=utf-8'
assert b'Super Fail!' in response.content

def test_warning(self, client):
def test_warning(self, client, monkeypatch):
class MyBackend(BaseHealthCheckBackend):
def check_status(self):
raise ServiceWarning('so so')
Expand All @@ -110,7 +110,7 @@ def check_status(self):
assert response.status_code == 500, response.content.decode('utf-8')
assert b'so so' in response.content, response.content

HEALTH_CHECK['WARNINGS_AS_ERRORS'] = False
monkeypatch.setitem(HEALTH_CHECK, 'WARNINGS_AS_ERRORS', False)

response = client.get(self.url)
assert response.status_code == 200, response.content.decode('utf-8')
Expand Down