summaryrefslogtreecommitdiffstats
path: root/tests/lsp_tests/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lsp_tests/conftest.py')
-rw-r--r--tests/lsp_tests/conftest.py36
1 files changed, 28 insertions, 8 deletions
diff --git a/tests/lsp_tests/conftest.py b/tests/lsp_tests/conftest.py
index ec12e9a..e995d88 100644
--- a/tests/lsp_tests/conftest.py
+++ b/tests/lsp_tests/conftest.py
@@ -1,5 +1,9 @@
import pytest
+from debian.debian_support import DpkgArchTable
+from debputy._deb_options_profiles import DebBuildOptionsAndProfiles
+from debputy.architecture_support import DpkgArchitectureBuildProcessValuesTable
+from debputy.packages import DctrlParser
from debputy.plugin.api.feature_set import PluginProvidedFeatureSet
from debputy.util import setup_logging
@@ -17,7 +21,7 @@ try:
HoverParams,
MarkupContent,
)
- from debputy.lsp.lsp_features import lsp_set_plugin_features
+ from debputy.lsp.debputy_ls import DebputyLanguageServer
HAS_PYGLS = True
except ImportError:
@@ -29,13 +33,31 @@ def enable_logging() -> None:
setup_logging(log_only_to_stderr=True, reconfigure_logging=True)
+@pytest.fixture
+def lsp_dctrl_parser(
+ dpkg_arch_query: DpkgArchTable,
+ amd64_dpkg_architecture_variables: DpkgArchitectureBuildProcessValuesTable,
+ no_profiles_or_build_options: DebBuildOptionsAndProfiles,
+) -> DctrlParser:
+ return DctrlParser(
+ frozenset(),
+ frozenset(),
+ True,
+ True,
+ amd64_dpkg_architecture_variables,
+ dpkg_arch_query,
+ no_profiles_or_build_options,
+ )
+
+
@pytest.fixture()
def ls(
debputy_plugin_feature_set: PluginProvidedFeatureSet,
-) -> "LanguageServer":
+ lsp_dctrl_parser: DctrlParser,
+) -> "DebputyLanguageServer":
if not HAS_PYGLS:
pytest.skip("Missing pygls")
- ls = LanguageServer("debputy", "v<test>")
+ ls = DebputyLanguageServer("debputy", "v<test>")
ls.lsp.lsp_initialize(
InitializeParams(
ClientCapabilities(
@@ -45,8 +67,6 @@ def ls(
)
)
)
- lsp_set_plugin_features(debputy_plugin_feature_set)
- try:
- yield ls
- finally:
- lsp_set_plugin_features(None)
+ ls.plugin_feature_set = debputy_plugin_feature_set
+ ls.dctrl_parser = lsp_dctrl_parser
+ return ls