summaryrefslogtreecommitdiffstats
path: root/tests/lint_tests/conftest.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 20:17:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 20:17:40 +0000
commitf89c0b08e32aa85d4b1e97ae2ab867ad1c011074 (patch)
treeb9e6e1336128c3f31b757ec7eae9173ebae472cd /tests/lint_tests/conftest.py
parentAdding upstream version 0.1.26. (diff)
downloaddebputy-f89c0b08e32aa85d4b1e97ae2ab867ad1c011074.tar.xz
debputy-f89c0b08e32aa85d4b1e97ae2ab867ad1c011074.zip
Adding upstream version 0.1.27.upstream/0.1.27
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/lint_tests/conftest.py')
-rw-r--r--tests/lint_tests/conftest.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lint_tests/conftest.py b/tests/lint_tests/conftest.py
new file mode 100644
index 0000000..d08f5ca
--- /dev/null
+++ b/tests/lint_tests/conftest.py
@@ -0,0 +1,30 @@
+import pytest
+
+from debputy.lsp.lsp_features import lsp_set_plugin_features
+from debputy.plugin.api.feature_set import PluginProvidedFeatureSet
+from debputy.util import setup_logging
+
+try:
+ from lsprotocol.types import Diagnostic
+
+ HAS_LSPROTOCOL = True
+except ImportError:
+ HAS_LSPROTOCOL = False
+
+
+@pytest.fixture(scope="session", autouse=True)
+def enable_logging() -> None:
+ if not HAS_LSPROTOCOL:
+ pytest.skip("Missing python3-lsprotocol")
+ setup_logging(reconfigure_logging=True)
+
+
+@pytest.fixture(autouse=True)
+def setup_feature_set(
+ debputy_plugin_feature_set: PluginProvidedFeatureSet,
+) -> None:
+ lsp_set_plugin_features(debputy_plugin_feature_set)
+ try:
+ yield
+ finally:
+ lsp_set_plugin_features(None)