From 2f5ba65446d80c5f58660c45f1028e76a5ad8e89 Mon Sep 17 00:00:00 2001 From: Martijn Jacobs Date: Fri, 6 Oct 2023 11:12:39 +0200 Subject: [PATCH] Improve test so we are sure the exclude section has this side-effect --- test/test_plugin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/test_plugin.py b/test/test_plugin.py index 237d8f5..5e39141 100644 --- a/test/test_plugin.py +++ b/test/test_plugin.py @@ -330,12 +330,15 @@ def foo(): assert diag["code"] == "unreachable" -def test_exclude_path_match_mypy_not_run(tmpdir, workspace): +def test_config_exclude(tmpdir, workspace): """When exclude is set in config then mypy should not run for that file.""" doc = Document(DOC_URI, workspace, DOC_TYPE_ERR) plugin.pylsp_settings(workspace._config) - workspace.update_config({"pylsp": {"plugins": {"pylsp_mypy": {"exclude": [doc.path]}}}}) + workspace.update_config({"pylsp": {"plugins": {"pylsp_mypy": {}}}}) diags = plugin.pylsp_lint(workspace._config, workspace, doc, is_saved=False) + assert diags[0]["message"] == TYPE_ERR_MSG - assert not diags + workspace.update_config({"pylsp": {"plugins": {"pylsp_mypy": {"exclude": [doc.path]}}}}) + diags = plugin.pylsp_lint(workspace._config, workspace, doc, is_saved=False) + assert diags == []