summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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
13 files changed, 50 insertions, 90 deletions
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,