Skip to content

Commit

Permalink
Improve test so we are sure the exclude section has this side-effect
Browse files Browse the repository at this point in the history
  • Loading branch information
maerteijn committed Oct 21, 2023
1 parent 1b2194a commit 2f5ba65
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 == []

0 comments on commit 2f5ba65

Please sign in to comment.