|
6 | 6 | from unittest.mock import Mock
|
7 | 7 |
|
8 | 8 | import pytest
|
9 |
| -from pylsp import uris |
| 9 | +from pylsp import _utils, uris |
10 | 10 | from pylsp.config.config import Config
|
11 | 11 | from pylsp.workspace import Document, Workspace
|
12 | 12 |
|
@@ -175,10 +175,13 @@ def test_option_overrides(tmpdir, last_diagnostics_monkeypatch, workspace):
|
175 | 175 | lambda _, p: {"overrides": overrides} if p == "pylsp_mypy" else {},
|
176 | 176 | )
|
177 | 177 |
|
| 178 | + config = FakeConfig(uris.to_fs_path(workspace.root_uri)) |
| 179 | + plugin.pylsp_settings(config) |
| 180 | + |
178 | 181 | assert not sentinel.exists()
|
179 | 182 |
|
180 | 183 | diags = plugin.pylsp_lint(
|
181 |
| - config=FakeConfig(uris.to_fs_path(workspace.root_uri)), |
| 184 | + config=config, |
182 | 185 | workspace=workspace,
|
183 | 186 | document=Document(DOC_URI, workspace, DOC_TYPE_ERR),
|
184 | 187 | is_saved=False,
|
@@ -206,8 +209,11 @@ def test_option_overrides_dmypy(last_diagnostics_monkeypatch, workspace):
|
206 | 209 |
|
207 | 210 | document = Document(DOC_URI, workspace, DOC_TYPE_ERR)
|
208 | 211 |
|
| 212 | + config = FakeConfig(uris.to_fs_path(workspace.root_uri)) |
| 213 | + plugin.pylsp_settings(config) |
| 214 | + |
209 | 215 | plugin.pylsp_lint(
|
210 |
| - config=FakeConfig(uris.to_fs_path(workspace.root_uri)), |
| 216 | + config=config, |
211 | 217 | workspace=workspace,
|
212 | 218 | document=document,
|
213 | 219 | is_saved=False,
|
@@ -243,10 +249,13 @@ def test_dmypy_status_file(tmpdir, last_diagnostics_monkeypatch, workspace):
|
243 | 249 |
|
244 | 250 | document = Document(DOC_URI, workspace, DOC_TYPE_ERR)
|
245 | 251 |
|
| 252 | + config = FakeConfig(uris.to_fs_path(workspace.root_uri)) |
| 253 | + plugin.pylsp_settings(config) |
| 254 | + |
246 | 255 | assert not statusFile.exists()
|
247 | 256 |
|
248 | 257 | plugin.pylsp_lint(
|
249 |
| - config=FakeConfig(uris.to_fs_path(workspace.root_uri)), |
| 258 | + config=config, |
250 | 259 | workspace=workspace,
|
251 | 260 | document=document,
|
252 | 261 | is_saved=False,
|
@@ -278,7 +287,8 @@ def foo():
|
278 | 287 | ws._config = Config(ws.root_uri, {}, 0, {})
|
279 | 288 |
|
280 | 289 | # Update settings for workspace.
|
281 |
| - plugin.pylsp_settings(ws._config) |
| 290 | + settings = plugin.pylsp_settings(ws._config) |
| 291 | + ws._config._plugin_settings = _utils.merge_dicts(ws._config._plugin_settings, settings) |
282 | 292 |
|
283 | 293 | # Test document to make sure it uses .config/mypy.ini configuration.
|
284 | 294 | doc = Document(DOC_URI, ws, DOC_SOURCE)
|
|
0 commit comments