##// END OF EJS Templates
tests: disable pretty error page handler for tests, with option to...
dan -
r735:eaa85268 default
parent child Browse files
Show More
@@ -158,6 +158,8 b' def load_pyramid_environment(global_conf'
158 158 # This has to be done before the database connection is initialized.
159 159 if settings['is_test']:
160 160 rhodecode.is_test = True
161 rhodecode.disable_error_handler = True
162
161 163 utils.initialize_test_environment(settings_merged)
162 164
163 165 # Initialize the database connection.
@@ -221,7 +221,8 b' def make_not_found_view(config):'
221 221 except Exception as e:
222 222 log.exception(e)
223 223
224 if settings.get('debugtoolbar.enabled', False):
224 if (settings.get('debugtoolbar.enabled', False) or
225 rhodecode.disable_error_handler):
225 226 raise
226 227
227 228 if isinstance(e, VCSCommunicationError):
@@ -20,6 +20,7 b''
20 20
21 21 import mock
22 22 import pytest
23 import rhodecode
23 24 import rhodecode.lib.vcs.client as client
24 25
25 26 @pytest.mark.usefixtures('autologin_user', 'app')
@@ -34,9 +35,13 b' def test_vcs_available_returns_summary_p'
34 35 def test_vcs_unavailable_returns_vcs_error_page(app, backend):
35 36 url = '/{repo_name}'.format(repo_name=backend.repo.repo_name)
36 37
38 try:
39 rhodecode.disable_error_handler = False
37 40 with mock.patch.object(client, '_get_proxy_method') as p:
38 41 p.side_effect = client.exceptions.PyroVCSCommunicationError()
39 42 response = app.get(url, expect_errors=True)
43 finally:
44 rhodecode.disable_error_handler = True
40 45
41 46 assert response.status_code == 502
42 47 assert 'Could not connect to VCS Server' in response.body
General Comments 0
You need to be logged in to leave comments. Login now