From 83b71b99895345bb004ff2148b53c23b5f16f409 Mon Sep 17 00:00:00 2001 From: Dillon Walls Date: Wed, 17 Jan 2024 12:26:13 -0500 Subject: [PATCH] add conftest.py that mocks out tg context --- conftest.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 conftest.py diff --git a/conftest.py b/conftest.py new file mode 100644 index 000000000..5c76dd455 --- /dev/null +++ b/conftest.py @@ -0,0 +1,24 @@ +import pytest + +# should get rid of this once this issue is fixed https://github.com/TurboGears/tg2/issues/136 +@pytest.fixture(autouse=True, scope='session') +def tg_context_patch(): + from tg import ( + request as r, + tmpl_context as c, + app_globals as g, + cache, + response, + translator, + url, + config, + ) + r.__dict__['_is_coroutine'] = False + c.__dict__['_is_coroutine'] = False + g.__dict__['_is_coroutine'] = False + cache.__dict__['_is_coroutine'] = False + response.__dict__['_is_coroutine'] = False + translator.__dict__['_is_coroutine'] = False + url.__dict__['_is_coroutine'] = False + config.__dict__['_is_coroutine'] = False + \ No newline at end of file