summaryrefslogtreecommitdiffstats
path: root/tests/lint_tests/conftest.py
blob: d08f5cabe779cc8c137529f145d74f1b33d3bef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)