From 11180d7be49c1912b7bdcba23d932747041e5b5d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 22:18:23 +0200 Subject: Merging upstream version 0.1.28. Signed-off-by: Daniel Baumann --- tests/lsp_tests/conftest.py | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'tests/lsp_tests/conftest.py') 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") + ls = DebputyLanguageServer("debputy", "v") 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 -- cgit v1.2.3