aports/testing/py3-gls/lsprotocol-2023.patch

57 lines
1.8 KiB
Diff

Patch-Source: https://github.com/openlawlibrary/pygls/pull/327
--
From 85c25278dad904ccaf388256ef58a51b575a74c0 Mon Sep 17 00:00:00 2001
From: Felix Yan <felixonmars@archlinux.org>
Date: Thu, 16 Mar 2023 02:17:47 +0200
Subject: [PATCH] Update typeguard to 3.x
Fixes incompatible function call and the expected test failure message.
---
CHANGELOG.md | 2 ++
CONTRIBUTORS.md | 1 +
pygls/lsp/__init__.py | 2 +-
setup.cfg | 2 +-
tests/test_feature_manager.py | 8 +++++---
5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/pygls/lsp/__init__.py b/pygls/lsp/__init__.py
index 51347110..b012a01a 100644
--- a/pygls/lsp/__init__.py
+++ b/pygls/lsp/__init__.py
@@ -122,7 +122,7 @@ def get_method_return_type(method_name, lsp_methods_map=METHOD_TO_TYPES):
def is_instance(o, t):
try:
- check_type('', o, t)
+ check_type(o, t)
return True
except TypeError:
return False
diff --git a/tests/test_feature_manager.py b/tests/test_feature_manager.py
index 020bf6bf..81941af7 100644
--- a/tests/test_feature_manager.py
+++ b/tests/test_feature_manager.py
@@ -24,6 +24,8 @@
)
from pygls.feature_manager import has_ls_param_or_annotation, wrap_with_server
from lsprotocol import types
+from typeguard import TypeCheckError
+from typeguard._utils import qualified_name
def test_has_ls_param_or_annotation():
@@ -92,10 +94,10 @@ class Options:
pass
with pytest.raises(
- TypeError,
+ TypeCheckError,
match=(
- f'Options of method "{types.TEXT_DOCUMENT_COMPLETION}" should be instance of type '
- "<class 'lsprotocol.types.CompletionOptions'>"
+ f'{qualified_name(Options)} is not an instance of '
+ "lsprotocol.types.CompletionOptions"
), # noqa
):