Skip to content

TypeError with pygls 2.0.0a4 #18

Open
@doronbehar

Description

@doronbehar

Hello.

I'm maintaining autotools-language-server on Nixpkgs. During the lsprotocol: 2023.0.1 -> 2025.0.0 update our CI detected that pygls needs to be updated to 2.0.0 (currently we use the [2.0.0a4 alpha tag](lsprotocol: 2023.0.1 -> 2025.0.0)) and that in turn made autotools-language-server get the following test failure:

============================= test session starts ==============================
platform linux -- Python 3.13.4, pytest-8.3.5, pluggy-1.6.0
rootdir: /build/source
configfile: pyproject.toml
plugins: typeguard-4.4.2
collected 3 items                                                              

tests/test_finders.py .                                                  [ 33%]
tests/test_utils.py F.                                                   [100%]

=================================== FAILURES ===================================
_______________________________ Test.test_check ________________________________

    @staticmethod
    def test_check() -> None:
        r"""Test check.
    
        :rtype: None
        """
>       result = check(
            [os.path.join(PATH, "Makefile")],
            parser.parse,
            DIAGNOSTICS_FINDER_CLASSES,
            None,
        )

tests/test_utils.py:22: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/diagnose.py:196: in check
    return check_by_finders(paths, parse, finders, color)
/nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/diagnose.py:165: in check_by_finders
    diagnostics = get_diagnostics_by_finders(path, tree, finders)
/nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/diagnose.py:36: in get_diagnostics_by_finders
    for diagnostic in finder.get_diagnostics(uri, tree)
/nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/__init__.py:448: in get_diagnostics
    return self.unis2diagnostics(self.find_all(uri, tree))
/nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/finders.py:599: in find_all
    return self.captures2unis(captures, uri)
/nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/finders.py:614: in captures2unis
    if uni := self.capture2uni(name, nodes, uri):
/nix/store/r347qmn3pg4pnviy2pk5r59lb3xaglgm-autotools-language-server-0.0.23a0/lib/python3.13/site-packages/make_language_server/finders.py:56: in capture2uni
    if label == "path" and not os.path.isfile(uni.get_path())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = UNI(uri='/build/source/tests/Makefile', node=<Node type=word, start_point=(3, 8), end_point=(3, 17)>)

    def get_path(self) -> str:
        r"""Get path.
    
        :rtype: str
        """
        if self.path is None:
>           raise TypeError
E           TypeError

/nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/__init__.py:131: TypeError
=============================== warnings summary ===============================
../../nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/finders.py:11
../../nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/finders.py:11
  /nix/store/n4a913519ly5az3cpc5z5h12k31dgn4v-python3.13-lsp-tree-sitter-0.0.17/lib/python3.13/site-packages/lsp_tree_sitter/finders.py:11: DeprecationWarning: Importing Validator directly from the jsonschema package is deprecated and will become an ImportError. Import it from jsonschema.protocols instead.
    from jsonschema import Validator

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_utils.py::Test::test_check - TypeError
=================== 1 failed, 2 passed, 2 warnings in 0.38s ====================

I thought you'd like to be aware of this to get ready to pygls version 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions