Skip to content

Running tests gives an error and never exits #679

@antonio-rojas

Description

@antonio-rojas

After commit 3b1c895, running the test suite with pytest -v gives an error in test_missing_message, and the pytests process never exits after printing the errors, it needs to be interrupted

ERROR test/test_language_server.py::test_missing_message - pylsp_jsonrpc.exceptions.JsonRpcInvalidParams: AttributeError: 'NoneType' object has no attribute 'plugin_manager'

Full error log:

_______________________________________________________ ERROR at teardown of test_missing_message ________________________________________________________

>       lambda: ihook(item=item, **kwds), when=when, reraise=reraise
                ^^^^^^^^^^^^^^^^^^^^^^^^
    )

/usr/lib/python3.13/site-packages/flaky/flaky_pytest_plugin.py:146: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/fixtures.py:177: in client_server_pair
    ).result(timeout=CALL_TIMEOUT_IN_SECONDS)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.13/concurrent/futures/_base.py:456: in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = None

    def __get_result(self):
        if self._exception is not None:
            try:
>               raise self._exception
E               pylsp_jsonrpc.exceptions.JsonRpcInvalidParams: AttributeError: 'NoneType' object has no attribute 'plugin_manager'

/usr/lib/python3.13/concurrent/futures/_base.py:401: JsonRpcInvalidParams
------------------------------------------------------------------ Captured stderr call ------------------------------------------------------------------
2025-10-13 12:29:35,614 CEST - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 26ef3d3d-1984-43ad-9e92-fd96bca36be0
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 193, in _handle_request
    handler = self._dispatcher[method]
              ~~~~~~~~~~~~~~~~^^^^^^^^
  File "/home/antonio/Software/test/python-lsp-server/pylsp/python_lsp.py", line 235, in __getitem__
    raise KeyError()
KeyError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 195, in _handle_request
    raise JsonRpcMethodNotFound.of(method) from e
pylsp_jsonrpc.exceptions.JsonRpcMethodNotFound: Method Not Found: unknown_method
------------------------------------------------------------------- Captured log call --------------------------------------------------------------------
ERROR    pylsp_jsonrpc.endpoint:endpoint.py:119 Failed to handle request 26ef3d3d-1984-43ad-9e92-fd96bca36be0
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 193, in _handle_request
    handler = self._dispatcher[method]
              ~~~~~~~~~~~~~~~~^^^^^^^^
  File "/home/antonio/Software/test/python-lsp-server/pylsp/python_lsp.py", line 235, in __getitem__
    raise KeyError()
KeyError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 195, in _handle_request
    raise JsonRpcMethodNotFound.of(method) from e
pylsp_jsonrpc.exceptions.JsonRpcMethodNotFound: Method Not Found: unknown_method
---------------------------------------------------------------- Captured stderr teardown ----------------------------------------------------------------
2025-10-13 12:29:35,617 CEST - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request ceb5ba62-8bb1-4f7d-bf7e-523becfa94e9
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request
    handler_result = handler(params)
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/home/antonio/Software/test/python-lsp-server/pylsp/python_lsp.py", line 240, in m_shutdown
    self._hook("pylsp_shutdown")
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/antonio/Software/test/python-lsp-server/pylsp/python_lsp.py", line 266, in _hook
    hook_handlers = self.config.plugin_manager.subset_hook_caller(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'plugin_manager'
----------------------------------------------------------------- Captured log teardown ------------------------------------------------------------------
ERROR    pylsp_jsonrpc.endpoint:endpoint.py:126 Failed to handle request ceb5ba62-8bb1-4f7d-bf7e-523becfa94e9
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/endpoint.py", line 197, in _handle_request
    handler_result = handler(params)
  File "/usr/lib/python3.13/site-packages/pylsp_jsonrpc/dispatchers.py", line 25, in handler
    return method(**(params or {}))
  File "/home/antonio/Software/test/python-lsp-server/pylsp/python_lsp.py", line 240, in m_shutdown
    self._hook("pylsp_shutdown")
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/antonio/Software/test/python-lsp-server/pylsp/python_lsp.py", line 266, in _hook
    hook_handlers = self.config.plugin_manager.subset_hook_caller(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'plugin_manager'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions