summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-11 17:11:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-11 17:11:02 +0000
commit503fe7dbcb39a6cf3f03e7b36cb3349f1fd321c5 (patch)
tree1c53ca0fa450a8997d7433b75cfa3bccdf189252
parentAdding upstream version 0.1.35. (diff)
downloaddebputy-503fe7dbcb39a6cf3f03e7b36cb3349f1fd321c5.tar.xz
debputy-503fe7dbcb39a6cf3f03e7b36cb3349f1fd321c5.zip
Adding upstream version 0.1.36.upstream/0.1.36
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--.gitlab-ci.yml48
-rw-r--r--src/debputy/dh_migration/migration.py12
-rw-r--r--src/debputy/linting/lint_impl.py2
-rw-r--r--src/debputy/linting/lint_util.py27
-rw-r--r--src/debputy/lsp/debputy_ls.py2
-rw-r--r--src/debputy/lsp/lsp_debian_changelog.py2
-rw-r--r--src/debputy/lsp/lsp_debian_control.py2
-rw-r--r--src/debputy/lsp/lsp_debian_control_reference_data.py2
-rw-r--r--src/debputy/lsp/lsp_debian_copyright.py2
-rw-r--r--src/debputy/lsp/lsp_debian_debputy_manifest.py2
-rw-r--r--src/debputy/lsp/lsp_debian_patches_series.py2
-rw-r--r--src/debputy/lsp/lsp_debian_rules.py45
-rw-r--r--src/debputy/lsp/lsp_debian_tests_control.py2
-rw-r--r--src/debputy/lsp/lsp_dispatch.py2
-rw-r--r--src/debputy/lsp/lsp_features.py2
-rw-r--r--src/debputy/lsp/lsp_generic_deb822.py2
-rw-r--r--src/debputy/lsp/lsp_generic_yaml.py2
-rw-r--r--src/debputy/lsp/quickfixes.py2
-rw-r--r--src/debputy/lsp/spellchecking.py2
-rw-r--r--src/debputy/lsp/text_edit.py2
-rw-r--r--src/debputy/lsp/text_util.py2
-rw-r--r--src/debputy/lsprotocol/__init__.py0
-rw-r--r--src/debputy/lsprotocol/types.py48
-rw-r--r--tests/lint_tests/conftest.py13
-rw-r--r--tests/lint_tests/lint_tutil.py5
-rw-r--r--tests/lint_tests/test_lint_changelog.py5
-rw-r--r--tests/lint_tests/test_lint_dcpy.py5
-rw-r--r--tests/lint_tests/test_lint_dctrl.py5
-rw-r--r--tests/lint_tests/test_lint_debputy.py5
-rw-r--r--tests/lint_tests/test_lint_dtctrl.py6
-rw-r--r--tests/lsp_tests/conftest.py19
-rw-r--r--tests/lsp_tests/lsp_tutil.py15
-rw-r--r--tests/lsp_tests/test_lsp_dctrl.py15
-rw-r--r--tests/lsp_tests/test_lsp_debputy_manifest_completer.py17
-rw-r--r--tests/lsp_tests/test_lsp_debputy_manifest_hover.py18
-rw-r--r--tests/lsp_tests/test_lsp_dpatches_series.py12
36 files changed, 242 insertions, 112 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d6cf11d..9f1b22e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -41,6 +41,15 @@ tests-ubuntu-noble:
- dpkg-buildpackage -Ppkg.debputy.ci -us -uc -tc
+tests-debian-bookwork-backports:
+ stage: os-build-tests
+ image: debian:bookworm-slim
+ script:
+ - apt-get update
+ - apt-get build-dep -Ppkg.debputy.ci,pkg.debputy.bookworm-backports -y .
+ - dpkg-buildpackage -Ppkg.debputy.ci,pkg.debputy.bookworm-backports -us -uc -tc
+
+
code-lint-mypy:
stage: ci-test
image: debian:unstable-slim
@@ -159,6 +168,45 @@ tests-ubuntu-noble-coverage-without-optional-bd:
coverage_format: cobertura
path: coverage.xml
+tests-debian-bookworm-backports-coverage-with-extra-bd:
+ stage: ci-os-support
+ image: debian:bookworm-slim
+ script:
+ - apt-get update
+ - apt-get build-dep -Ppkg.debputy.ci,pkg.debputy.test-coverage,pkg.debputy.bookworm-backports -y .
+ - py.test-3 -v --cov --cov-branch --doctest-modules --junit-xml=xunit-report.xml --cov-report xml:coverage.xml
+ after_script:
+ - mkdir -p coverage-results/tests-ubuntu-noble-coverage-with-extra-bd
+ - cp .coverage coverage-results/tests-ubuntu-noble-coverage-with-extra-bd/coverage
+ artifacts:
+ paths:
+ - coverage-results/tests-ubuntu-noble-coverage-with-extra-bd
+ reports:
+ junit: xunit-report.xml
+ coverage_report:
+ coverage_format: cobertura
+ path: coverage.xml
+
+
+tests-debian-bookworm-backports-coverage-without-optional-bd:
+ stage: ci-os-support
+ image: debian:bookworm-slim
+ script:
+ - apt-get update
+ - apt-get build-dep -Ppkg.debputy.minimal-tests,pkg.debputy.test-coverage,pkg.debputy.bookworm-backports -y .
+ - py.test-3 -v --cov --cov-branch --doctest-modules --junit-xml=xunit-report.xml --cov-report xml:coverage.xml
+ after_script:
+ - mkdir -p coverage-results/tests-ubuntu-noble-coverage-without-optional-bd
+ - cp .coverage coverage-results/tests-ubuntu-noble-coverage-without-optional-bd/coverage
+ artifacts:
+ paths:
+ - coverage-results/tests-ubuntu-noble-coverage-without-optional-bd
+ reports:
+ junit: xunit-report.xml
+ coverage_report:
+ coverage_format: cobertura
+ path: coverage.xml
+
aggregate-coverage:
stage: aggregate-coverage
diff --git a/src/debputy/dh_migration/migration.py b/src/debputy/dh_migration/migration.py
index bcdd3f9..a1bd15a 100644
--- a/src/debputy/dh_migration/migration.py
+++ b/src/debputy/dh_migration/migration.py
@@ -3,7 +3,7 @@ import os
import re
import subprocess
from itertools import chain
-from typing import Optional, List, Callable, Set
+from typing import Optional, List, Callable, Set, Container
from debian.deb822 import Deb822
@@ -140,6 +140,16 @@ def _requested_debputy_plugins(debian_dir: VirtualPath) -> Optional[Set[str]]:
return plugins
+def determine_debputy_integration_level(sequences: Container[str]) -> Optional[str]:
+ has_zz_debputy = "zz-debputy" in sequences or "debputy" in sequences
+ has_zz_debputy_rrr = "zz-debputy-rrr" in sequences
+ if has_zz_debputy:
+ return MIGRATION_TARGET_DH_DEBPUTY
+ if has_zz_debputy_rrr:
+ return MIGRATION_TARGET_DH_DEBPUTY_RRR
+ return None
+
+
def _check_migration_target(
debian_dir: VirtualPath,
migration_target: Optional[str],
diff --git a/src/debputy/linting/lint_impl.py b/src/debputy/linting/lint_impl.py
index 63f4e77..b424460 100644
--- a/src/debputy/linting/lint_impl.py
+++ b/src/debputy/linting/lint_impl.py
@@ -6,7 +6,7 @@ import sys
import textwrap
from typing import Optional, List, Union, NoReturn, Mapping
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
CodeAction,
Command,
CodeActionParams,
diff --git a/src/debputy/linting/lint_util.py b/src/debputy/linting/lint_util.py
index 1fde104..0c293f0 100644
--- a/src/debputy/linting/lint_util.py
+++ b/src/debputy/linting/lint_util.py
@@ -17,9 +17,17 @@ from typing import (
cast,
)
-from lsprotocol.types import Position, Range, Diagnostic, DiagnosticSeverity, TextEdit
+from debputy.lsprotocol.types import (
+ Position,
+ Range,
+ Diagnostic,
+ DiagnosticSeverity,
+ TextEdit,
+)
from debputy.commands.debputy_cmd.output import OutputStylingBase
+from debputy.debhelper_emulation import extract_dh_addons_from_control
+from debputy.dh_migration.migration import determine_debputy_integration_level
from debputy.filesystem_scan import VirtualPathBase
from debputy.lsp.diagnostics import LintSeverity
from debputy.lsp.vendoring._deb822_repro import Deb822FileElement, parse_deb822_file
@@ -39,6 +47,19 @@ LinterImpl = Callable[["LintState"], Optional[List[Diagnostic]]]
FormatterImpl = Callable[["LintState"], Optional[Sequence[TextEdit]]]
+@dataclasses.dataclass(slots=True)
+class DebputyMetadata:
+ debputy_integration_level: Optional[str]
+
+ @classmethod
+ def from_data(cls, source_data: Optional[SourcePackage]) -> typing.Self:
+ sequences = set()
+ if source_data:
+ extract_dh_addons_from_control(source_data.fields, sequences)
+ integration_level = determine_debputy_integration_level(sequences)
+ return cls(integration_level)
+
+
class LintState:
@property
@@ -93,6 +114,10 @@ class LintState:
def effective_preference(self) -> Optional["EffectivePreference"]:
raise NotImplementedError
+ @property
+ def debputy_metadata(self) -> DebputyMetadata:
+ return DebputyMetadata.from_data(self.source_package)
+
@dataclasses.dataclass(slots=True)
class LintStateImpl(LintState):
diff --git a/src/debputy/lsp/debputy_ls.py b/src/debputy/lsp/debputy_ls.py
index 290997f..2009fd7 100644
--- a/src/debputy/lsp/debputy_ls.py
+++ b/src/debputy/lsp/debputy_ls.py
@@ -11,7 +11,7 @@ from typing import (
Literal,
)
-from lsprotocol.types import MarkupKind
+from debputy.lsprotocol.types import MarkupKind
from debputy.filesystem_scan import FSROOverlay, VirtualPathBase
from debputy.linting.lint_util import (
diff --git a/src/debputy/lsp/lsp_debian_changelog.py b/src/debputy/lsp/lsp_debian_changelog.py
index 824bc87..bde15b5 100644
--- a/src/debputy/lsp/lsp_debian_changelog.py
+++ b/src/debputy/lsp/lsp_debian_changelog.py
@@ -9,7 +9,7 @@ from typing import (
Iterable,
)
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
Diagnostic,
DidOpenTextDocumentParams,
DidChangeTextDocumentParams,
diff --git a/src/debputy/lsp/lsp_debian_control.py b/src/debputy/lsp/lsp_debian_control.py
index 42f6a65..6e775c5 100644
--- a/src/debputy/lsp/lsp_debian_control.py
+++ b/src/debputy/lsp/lsp_debian_control.py
@@ -11,7 +11,7 @@ from typing import (
Dict,
)
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
DiagnosticSeverity,
Range,
Diagnostic,
diff --git a/src/debputy/lsp/lsp_debian_control_reference_data.py b/src/debputy/lsp/lsp_debian_control_reference_data.py
index 42af500..f4a962a 100644
--- a/src/debputy/lsp/lsp_debian_control_reference_data.py
+++ b/src/debputy/lsp/lsp_debian_control_reference_data.py
@@ -26,7 +26,7 @@ from typing import (
)
from debian.debian_support import DpkgArchTable, Version
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
DiagnosticSeverity,
Diagnostic,
DiagnosticTag,
diff --git a/src/debputy/lsp/lsp_debian_copyright.py b/src/debputy/lsp/lsp_debian_copyright.py
index 54fb75e..a6d5573 100644
--- a/src/debputy/lsp/lsp_debian_copyright.py
+++ b/src/debputy/lsp/lsp_debian_copyright.py
@@ -9,7 +9,7 @@ from typing import (
Dict,
)
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
DiagnosticSeverity,
Range,
Diagnostic,
diff --git a/src/debputy/lsp/lsp_debian_debputy_manifest.py b/src/debputy/lsp/lsp_debian_debputy_manifest.py
index bd3c746..78575cb 100644
--- a/src/debputy/lsp/lsp_debian_debputy_manifest.py
+++ b/src/debputy/lsp/lsp_debian_debputy_manifest.py
@@ -11,7 +11,7 @@ from typing import (
get_origin,
)
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
Diagnostic,
TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL,
Position,
diff --git a/src/debputy/lsp/lsp_debian_patches_series.py b/src/debputy/lsp/lsp_debian_patches_series.py
index 81ae32f..8fb5122 100644
--- a/src/debputy/lsp/lsp_debian_patches_series.py
+++ b/src/debputy/lsp/lsp_debian_patches_series.py
@@ -28,7 +28,7 @@ from debputy.lsp.quickfixes import (
from debputy.lsp.text_util import (
SemanticTokensState,
)
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
CompletionItem,
Diagnostic,
CompletionList,
diff --git a/src/debputy/lsp/lsp_debian_rules.py b/src/debputy/lsp/lsp_debian_rules.py
index c2bf56d..072b785 100644
--- a/src/debputy/lsp/lsp_debian_rules.py
+++ b/src/debputy/lsp/lsp_debian_rules.py
@@ -13,9 +13,10 @@ from typing import (
Iterator,
Tuple,
Set,
+ FrozenSet,
)
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
CompletionItem,
Diagnostic,
Range,
@@ -28,6 +29,7 @@ from lsprotocol.types import (
)
from debputy.debhelper_emulation import parse_drules_for_addons
+from debputy.dh_migration.migrators_impl import DH_COMMANDS_REPLACED
from debputy.linting.lint_util import LintState
from debputy.lsp.diagnostics import DiagnosticData
from debputy.lsp.lsp_features import (
@@ -226,6 +228,18 @@ def iter_make_lines(
yield line_no, line
+def _forbidden_hook_targets(lint_state: LintState) -> FrozenSet[str]:
+ debputy_integration_level = lint_state.debputy_metadata.debputy_integration_level
+ if debputy_integration_level is None:
+ return frozenset()
+ commands = DH_COMMANDS_REPLACED.get(debputy_integration_level)
+ if not commands:
+ return frozenset()
+ return frozenset(
+ itertools.chain.from_iterable(_as_hook_targets(c) for c in commands)
+ )
+
+
def _lint_debian_rules_impl(
lint_state: LintState,
) -> Optional[List[Diagnostic]]:
@@ -251,6 +265,8 @@ def _lint_debian_rules_impl(
source = "debputy"
missing_targets = {}
+ forbidden_hook_targets = _forbidden_hook_targets(lint_state)
+ all_allowed_hook_targets = all_hook_targets - forbidden_hook_targets
for line_no, line in iter_make_lines(lines, position_codec, diagnostics):
try:
@@ -268,14 +284,37 @@ def _lint_debian_rules_impl(
break
if "%" in target or "$" in target:
continue
- if target in all_hook_targets or target in missing_targets:
+ if target in forbidden_hook_targets:
+ pos, endpos = m.span(1)
+ r_server_units = Range(
+ Position(
+ line_no,
+ pos,
+ ),
+ Position(
+ line_no,
+ endpos,
+ ),
+ )
+ r = position_codec.range_to_client_units(lines, r_server_units)
+ diagnostics.append(
+ Diagnostic(
+ r,
+ f"The hook target {target} will not be run due to the choice of sequences.",
+ severity=DiagnosticSeverity.Error,
+ source=source,
+ )
+ )
+ continue
+
+ if target in all_allowed_hook_targets or target in missing_targets:
continue
pos, endpos = m.span(1)
hook_location = line_no, pos, endpos
missing_targets[target] = hook_location
for target, (line_no, pos, endpos) in missing_targets.items():
- candidates = _detect_possible_typo(target, all_hook_targets)
+ candidates = _detect_possible_typo(target, all_allowed_hook_targets)
if not candidates and not target.startswith(
("override_", "execute_before_", "execute_after_")
):
diff --git a/src/debputy/lsp/lsp_debian_tests_control.py b/src/debputy/lsp/lsp_debian_tests_control.py
index 111aae8..3562917 100644
--- a/src/debputy/lsp/lsp_debian_tests_control.py
+++ b/src/debputy/lsp/lsp_debian_tests_control.py
@@ -9,7 +9,7 @@ from typing import (
Dict,
)
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
DiagnosticSeverity,
Range,
Diagnostic,
diff --git a/src/debputy/lsp/lsp_dispatch.py b/src/debputy/lsp/lsp_dispatch.py
index 8f370ef..e5def62 100644
--- a/src/debputy/lsp/lsp_dispatch.py
+++ b/src/debputy/lsp/lsp_dispatch.py
@@ -24,7 +24,7 @@ from debputy.lsp.lsp_features import (
C,
)
from debputy.util import _info
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
DidOpenTextDocumentParams,
DidChangeTextDocumentParams,
TEXT_DOCUMENT_DID_CHANGE,
diff --git a/src/debputy/lsp/lsp_features.py b/src/debputy/lsp/lsp_features.py
index 16e9d4d..800f738 100644
--- a/src/debputy/lsp/lsp_features.py
+++ b/src/debputy/lsp/lsp_features.py
@@ -18,7 +18,7 @@ from typing import (
from debputy.commands.debputy_cmd.context import CommandContext
from debputy.commands.debputy_cmd.output import _output_styling
from debputy.lsp.lsp_self_check import LSP_CHECKS
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
TEXT_DOCUMENT_WILL_SAVE_WAIT_UNTIL,
TEXT_DOCUMENT_CODE_ACTION,
DidChangeTextDocumentParams,
diff --git a/src/debputy/lsp/lsp_generic_deb822.py b/src/debputy/lsp/lsp_generic_deb822.py
index c8b476a..d8b9596 100644
--- a/src/debputy/lsp/lsp_generic_deb822.py
+++ b/src/debputy/lsp/lsp_generic_deb822.py
@@ -15,7 +15,7 @@ from typing import (
cast,
)
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
CompletionParams,
CompletionList,
CompletionItem,
diff --git a/src/debputy/lsp/lsp_generic_yaml.py b/src/debputy/lsp/lsp_generic_yaml.py
index e464bdc..94267f7 100644
--- a/src/debputy/lsp/lsp_generic_yaml.py
+++ b/src/debputy/lsp/lsp_generic_yaml.py
@@ -14,7 +14,7 @@ from debputy.plugin.api.impl_types import (
DispatchingParserBase,
)
from debputy.util import _info, _warn
-from lsprotocol.types import MarkupContent, MarkupKind, Hover, Position, Range
+from debputy.lsprotocol.types import MarkupContent, MarkupKind, Hover, Position, Range
try:
from pygls.server import LanguageServer
diff --git a/src/debputy/lsp/quickfixes.py b/src/debputy/lsp/quickfixes.py
index 8787d9f..952506d 100644
--- a/src/debputy/lsp/quickfixes.py
+++ b/src/debputy/lsp/quickfixes.py
@@ -13,7 +13,7 @@ from typing import (
NotRequired,
)
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
CodeAction,
Command,
CodeActionParams,
diff --git a/src/debputy/lsp/spellchecking.py b/src/debputy/lsp/spellchecking.py
index 4cf71f2..223582d 100644
--- a/src/debputy/lsp/spellchecking.py
+++ b/src/debputy/lsp/spellchecking.py
@@ -6,7 +6,7 @@ import subprocess
from typing import Iterable, FrozenSet, Tuple, Optional, List
from debian.debian_support import Release
-from lsprotocol.types import Diagnostic, Range, Position, DiagnosticSeverity
+from debputy.lsprotocol.types import Diagnostic, Range, Position, DiagnosticSeverity
from debputy.lsp.diagnostics import DiagnosticData
from debputy.lsp.quickfixes import propose_correct_text_quick_fix
diff --git a/src/debputy/lsp/text_edit.py b/src/debputy/lsp/text_edit.py
index 4b210b2..af13e7d 100644
--- a/src/debputy/lsp/text_edit.py
+++ b/src/debputy/lsp/text_edit.py
@@ -6,7 +6,7 @@
#
from typing import List, Sequence
-from lsprotocol.types import Range, TextEdit, Position
+from debputy.lsprotocol.types import Range, TextEdit, Position
def get_well_formatted_range(lsp_range: Range) -> Range:
diff --git a/src/debputy/lsp/text_util.py b/src/debputy/lsp/text_util.py
index dd87571..8228fef 100644
--- a/src/debputy/lsp/text_util.py
+++ b/src/debputy/lsp/text_util.py
@@ -1,6 +1,6 @@
from typing import List, Optional, Sequence, Union, Iterable, TYPE_CHECKING
-from lsprotocol.types import (
+from debputy.lsprotocol.types import (
TextEdit,
Position,
Range,
diff --git a/src/debputy/lsprotocol/__init__.py b/src/debputy/lsprotocol/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/debputy/lsprotocol/__init__.py
diff --git a/src/debputy/lsprotocol/types.py b/src/debputy/lsprotocol/types.py
new file mode 100644
index 0000000..a57c4e0
--- /dev/null
+++ b/src/debputy/lsprotocol/types.py
@@ -0,0 +1,48 @@
+"""Wrapper module around `lsprotocol.types`
+
+This wrapper module is here to facility making `lsprotocol` optional
+for -backports. When available, it is a (mostly) transparent wrapper
+for the real module. When missing, it returns a placeholder object
+for anything for the purpose of making things simpler.
+"""
+
+from typing import TYPE_CHECKING, Any, Iterator, List
+
+if TYPE_CHECKING:
+ from lsprotocol import types
+
+ # To defeat "unused" detections that might attempt to
+ # optimize out the import
+ assert types is not None
+ __all__ = dir(types)
+
+else:
+ try:
+ from lsprotocol import types
+
+ __all__ = dir(types)
+
+ except ImportError:
+
+ class StubModule:
+
+ @staticmethod
+ def __getattr__(item: Any) -> Any:
+ return types
+
+ def __call__(self, *args, **kwargs) -> Any:
+ return self
+
+ def __iter__(self) -> Iterator[Any]:
+ return iter(())
+
+ types = StubModule()
+ __all__ = []
+
+
+def __dir__() -> List[str]:
+ return dir(types)
+
+
+def __getattr__(name: str) -> Any:
+ return getattr(types, name)
diff --git a/tests/lint_tests/conftest.py b/tests/lint_tests/conftest.py
index bf4b3b0..e364bbc 100644
--- a/tests/lint_tests/conftest.py
+++ b/tests/lint_tests/conftest.py
@@ -3,22 +3,25 @@ from debian.debian_support import DpkgArchTable
from debputy._deb_options_profiles import DebBuildOptionsAndProfiles
from debputy.architecture_support import DpkgArchitectureBuildProcessValuesTable
-from debputy.lsp.style_prefs import StylePreferenceTable
from debputy.packages import DctrlParser
from debputy.util import setup_logging
try:
- from lsprotocol.types import Diagnostic
from debputy.lsp.spellchecking import disable_spellchecking
-
- HAS_LSPROTOCOL = True
except ImportError:
- HAS_LSPROTOCOL = False
def disable_spellchecking() -> None:
pass
+try:
+ from lsprotocol import types
+except ImportError:
+ HAS_LSPROTOCOL = False
+else:
+ HAS_LSPROTOCOL = True
+
+
@pytest.fixture(scope="session", autouse=True)
def enable_logging() -> None:
if not HAS_LSPROTOCOL:
diff --git a/tests/lint_tests/lint_tutil.py b/tests/lint_tests/lint_tutil.py
index 65fe0ad..267f669 100644
--- a/tests/lint_tests/lint_tutil.py
+++ b/tests/lint_tests/lint_tutil.py
@@ -13,10 +13,7 @@ from debputy.lsp.style_prefs import StylePreferenceTable, EffectivePreference
from debputy.packages import DctrlParser
from debputy.plugin.api.feature_set import PluginProvidedFeatureSet
-try:
- from lsprotocol.types import Diagnostic, DiagnosticSeverity
-except ImportError:
- pass
+from debputy.lsprotocol.types import Diagnostic, DiagnosticSeverity
try:
diff --git a/tests/lint_tests/test_lint_changelog.py b/tests/lint_tests/test_lint_changelog.py
index b5ab69e..2e48b82 100644
--- a/tests/lint_tests/test_lint_changelog.py
+++ b/tests/lint_tests/test_lint_changelog.py
@@ -7,10 +7,7 @@ from debputy.packages import DctrlParser
from debputy.plugin.api.feature_set import PluginProvidedFeatureSet
from lint_tests.lint_tutil import LintWrapper
-try:
- from lsprotocol.types import Diagnostic, DiagnosticSeverity
-except ImportError:
- pass
+from debputy.lsprotocol.types import DiagnosticSeverity
@pytest.fixture
diff --git a/tests/lint_tests/test_lint_dcpy.py b/tests/lint_tests/test_lint_dcpy.py
index f827d3e..9b89b67 100644
--- a/tests/lint_tests/test_lint_dcpy.py
+++ b/tests/lint_tests/test_lint_dcpy.py
@@ -10,10 +10,7 @@ from lint_tests.lint_tutil import (
LintWrapper,
)
-try:
- from lsprotocol.types import Diagnostic, DiagnosticSeverity
-except ImportError:
- pass
+from debputy.lsprotocol.types import DiagnosticSeverity
@pytest.fixture
diff --git a/tests/lint_tests/test_lint_dctrl.py b/tests/lint_tests/test_lint_dctrl.py
index 7478461..6479886 100644
--- a/tests/lint_tests/test_lint_dctrl.py
+++ b/tests/lint_tests/test_lint_dctrl.py
@@ -13,10 +13,7 @@ from lint_tests.lint_tutil import (
LintWrapper,
)
-try:
- from lsprotocol.types import Diagnostic, DiagnosticSeverity
-except ImportError:
- pass
+from debputy.lsprotocol.types import Diagnostic, DiagnosticSeverity
class DctrlLintWrapper(LintWrapper):
diff --git a/tests/lint_tests/test_lint_debputy.py b/tests/lint_tests/test_lint_debputy.py
index 28dab00..2af34ae 100644
--- a/tests/lint_tests/test_lint_debputy.py
+++ b/tests/lint_tests/test_lint_debputy.py
@@ -11,10 +11,7 @@ from lint_tests.lint_tutil import (
group_diagnostics_by_severity,
)
-try:
- from lsprotocol.types import Diagnostic, DiagnosticSeverity
-except ImportError:
- pass
+from debputy.lsprotocol.types import DiagnosticSeverity
@pytest.fixture
diff --git a/tests/lint_tests/test_lint_dtctrl.py b/tests/lint_tests/test_lint_dtctrl.py
index 6127dd9..9b58076 100644
--- a/tests/lint_tests/test_lint_dtctrl.py
+++ b/tests/lint_tests/test_lint_dtctrl.py
@@ -7,16 +7,10 @@ from debputy.lsp.lsp_debian_tests_control import _lint_debian_tests_control
from debputy.packages import DctrlParser
from debputy.plugin.api.feature_set import PluginProvidedFeatureSet
from lint_tests.lint_tutil import (
- group_diagnostics_by_severity,
requires_levenshtein,
LintWrapper,
)
-try:
- from lsprotocol.types import Diagnostic, DiagnosticSeverity
-except ImportError:
- pass
-
@pytest.fixture
def line_linter(
diff --git a/tests/lsp_tests/conftest.py b/tests/lsp_tests/conftest.py
index e995d88..c3c286e 100644
--- a/tests/lsp_tests/conftest.py
+++ b/tests/lsp_tests/conftest.py
@@ -7,20 +7,15 @@ from debputy.packages import DctrlParser
from debputy.plugin.api.feature_set import PluginProvidedFeatureSet
from debputy.util import setup_logging
+from debputy.lsprotocol.types import (
+ InitializeParams,
+ ClientCapabilities,
+ GeneralClientCapabilities,
+ PositionEncodingKind,
+)
+
try:
from pygls.server import LanguageServer
- from lsprotocol.types import (
- InitializeParams,
- ClientCapabilities,
- GeneralClientCapabilities,
- PositionEncodingKind,
- TextDocumentItem,
- Position,
- CompletionParams,
- TextDocumentIdentifier,
- HoverParams,
- MarkupContent,
- )
from debputy.lsp.debputy_ls import DebputyLanguageServer
HAS_PYGLS = True
diff --git a/tests/lsp_tests/lsp_tutil.py b/tests/lsp_tests/lsp_tutil.py
index bc0fa91..8c0827e 100644
--- a/tests/lsp_tests/lsp_tutil.py
+++ b/tests/lsp_tests/lsp_tutil.py
@@ -1,16 +1,17 @@
import dataclasses
-from typing import Tuple, Union, FrozenSet, Optional, List
+from typing import Tuple, FrozenSet, Optional, List
from debputy.lsp.lsp_features import SEMANTIC_TOKENS_LEGEND
from debputy.util import grouper
+from debputy.lsprotocol.types import (
+ TextDocumentItem,
+ Position,
+ Range,
+ SemanticTokens,
+)
+
try:
- from lsprotocol.types import (
- TextDocumentItem,
- Position,
- Range,
- SemanticTokens,
- )
from debputy.lsp.debputy_ls import DebputyLanguageServer
except ImportError:
pass
diff --git a/tests/lsp_tests/test_lsp_dctrl.py b/tests/lsp_tests/test_lsp_dctrl.py
index e93ba17..ab55bb8 100644
--- a/tests/lsp_tests/test_lsp_dctrl.py
+++ b/tests/lsp_tests/test_lsp_dctrl.py
@@ -4,16 +4,15 @@ from typing import Optional
import pytest
from debputy.lsp.debputy_ls import DebputyLanguageServer
+from debputy.lsprotocol.types import (
+ CompletionParams,
+ TextDocumentIdentifier,
+ HoverParams,
+ MarkupContent,
+ SemanticTokensParams,
+)
try:
- from lsprotocol.types import (
- CompletionParams,
- TextDocumentIdentifier,
- HoverParams,
- MarkupContent,
- SemanticTokensParams,
- )
-
from debputy.lsp.lsp_debian_control import (
_debian_control_completions,
_debian_control_hover,
diff --git a/tests/lsp_tests/test_lsp_debputy_manifest_completer.py b/tests/lsp_tests/test_lsp_debputy_manifest_completer.py
index dab26d3..f052164 100644
--- a/tests/lsp_tests/test_lsp_debputy_manifest_completer.py
+++ b/tests/lsp_tests/test_lsp_debputy_manifest_completer.py
@@ -1,21 +1,14 @@
import textwrap
+from debputy.lsprotocol.types import (
+ CompletionParams,
+ TextDocumentIdentifier,
+)
from lsp_tests.lsp_tutil import put_doc_with_cursor
try:
from pygls.server import LanguageServer
- from lsprotocol.types import (
- InitializeParams,
- ClientCapabilities,
- GeneralClientCapabilities,
- PositionEncodingKind,
- TextDocumentItem,
- Position,
- CompletionParams,
- TextDocumentIdentifier,
- HoverParams,
- MarkupContent,
- )
+
from debputy.lsp.lsp_debian_debputy_manifest import debputy_manifest_completer
from debputy.lsp.debputy_ls import DebputyLanguageServer
diff --git a/tests/lsp_tests/test_lsp_debputy_manifest_hover.py b/tests/lsp_tests/test_lsp_debputy_manifest_hover.py
index 54c6b6a..06422ca 100644
--- a/tests/lsp_tests/test_lsp_debputy_manifest_hover.py
+++ b/tests/lsp_tests/test_lsp_debputy_manifest_hover.py
@@ -5,20 +5,14 @@ import pytest
from debputy.lsp.debputy_ls import DebputyLanguageServer
from lsp_tests.lsp_tutil import put_doc_with_cursor
+from debputy.lsprotocol.types import (
+ TextDocumentIdentifier,
+ HoverParams,
+ MarkupContent,
+)
+
try:
from pygls.server import LanguageServer
- from lsprotocol.types import (
- InitializeParams,
- ClientCapabilities,
- GeneralClientCapabilities,
- PositionEncodingKind,
- TextDocumentItem,
- Position,
- CompletionParams,
- TextDocumentIdentifier,
- HoverParams,
- MarkupContent,
- )
from debputy.lsp.lsp_debian_debputy_manifest import debputy_manifest_hover
HAS_PYGLS = True
diff --git a/tests/lsp_tests/test_lsp_dpatches_series.py b/tests/lsp_tests/test_lsp_dpatches_series.py
index e7a1275..6e0ff3f 100644
--- a/tests/lsp_tests/test_lsp_dpatches_series.py
+++ b/tests/lsp_tests/test_lsp_dpatches_series.py
@@ -1,16 +1,12 @@
import textwrap
from debputy.lsp.debputy_ls import DebputyLanguageServer
+from debputy.lsprotocol.types import (
+ TextDocumentIdentifier,
+ SemanticTokensParams,
+)
try:
- from lsprotocol.types import (
- CompletionParams,
- TextDocumentIdentifier,
- HoverParams,
- MarkupContent,
- SemanticTokensParams,
- )
-
from debputy.lsp.lsp_debian_patches_series import (
_debian_patches_semantic_tokens_full,
_debian_patches_series_completions,