|
3 | 3 | import pytest |
4 | 4 | import web |
5 | 5 |
|
| 6 | +from infogami import config |
6 | 7 | from infogami.infobase.tests.pytest_wildcard import Wildcard |
7 | 8 | from infogami.utils import template |
8 | 9 | from infogami.utils.view import render_template as infobase_render_template |
|
15 | 16 | from openlibrary.mocks.mock_memcache import ( |
16 | 17 | mock_memcache, # noqa: F401 side effects may be needed |
17 | 18 | ) |
| 19 | +from openlibrary.utils.request_context import RequestContextVars, req_context |
18 | 20 |
|
19 | 21 |
|
20 | 22 | @pytest.fixture(autouse=True) |
@@ -54,10 +56,6 @@ def setup_db_config(): |
54 | 56 | which is necessary for the context variable infrastructure being added. Without this, tests may fail due to |
55 | 57 | missing or incorrect database parameters when initializing site. |
56 | 58 | """ |
57 | | - import web |
58 | | - |
59 | | - from infogami import config |
60 | | - |
61 | 59 | # Set web.config.db_parameters for OLConnection |
62 | 60 | web.config.db_parameters = {} |
63 | 61 |
|
@@ -89,7 +87,6 @@ def request_context_fixture(): |
89 | 87 | Provides defaults and allows tests to override any subset of fields. |
90 | 88 | Automatically cleans up after the test. |
91 | 89 | """ |
92 | | - from openlibrary.utils.request_context import RequestContextVars, req_context |
93 | 90 |
|
94 | 91 | tokens = [] |
95 | 92 |
|
@@ -149,12 +146,12 @@ def render_template(request): |
149 | 146 |
|
150 | 147 | # ol_infobase.init_plugin call is failing when trying to import plugins.openlibrary.code. |
151 | 148 | # monkeypatch to avoid that. |
152 | | - from openlibrary.plugins import ol_infobase |
| 149 | + from openlibrary.plugins import ol_infobase # noqa: PLC0415 |
153 | 150 |
|
154 | 151 | init_plugin = ol_infobase.init_plugin |
155 | 152 | ol_infobase.init_plugin = lambda: None |
156 | 153 |
|
157 | | - from openlibrary.plugins.openlibrary import code |
| 154 | + from openlibrary.plugins.openlibrary import code # noqa: PLC0415 |
158 | 155 |
|
159 | 156 | web.config.db_parameters = {} |
160 | 157 | code.setup_template_globals() |
|
0 commit comments