##// END OF EJS Templates
tests: Add an autouse fixture to patch the pyro proxy factory.
Martin Bornhold -
r343:73e7f43f default
parent child Browse files
Show More
@@ -285,6 +285,27 b' def tests_tmp_path(request):'
285 285 return TESTS_TMP_PATH
286 286
287 287
288 @pytest.fixture(scope='session', autouse=True)
289 def patch_pyro_request_scope_proxy_factory(request):
290 """
291 Patch the pyro proxy factory to always use the same dummy request object
292 when under test. This will return the same pyro proxy on every call.
293 """
294 dummy_request = pyramid.testing.DummyRequest()
295
296 def mocked_call(self, request=None):
297 return self.getProxy(request=dummy_request)
298
299 patcher = mock.patch(
300 'rhodecode.lib.vcs.client.RequestScopeProxyFactory.__call__',
301 new=mocked_call)
302 patcher.start()
303
304 @request.addfinalizer
305 def undo_patching():
306 patcher.stop()
307
308
288 309 @pytest.fixture
289 310 def test_repo_group(request):
290 311 """
General Comments 0
You need to be logged in to leave comments. Login now