Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warning #48

Closed
alcarney opened this issue Mar 24, 2023 · 2 comments
Closed

Deprecation warning #48

alcarney opened this issue Mar 24, 2023 · 2 comments
Labels
pytest-lsp Issues affecting the pytest-lsp package

Comments

@alcarney
Copy link
Member

============================================================================================================= test session starts =============================================================================================================
platform linux -- Python 3.7.16, pytest-7.2.2, pluggy-1.0.0
rootdir: /tmp/pytest-of-alex/pytest-9/test_detect_invalid_json0, configfile: tox.ini
plugins: typeguard-2.13.3, asyncio-0.21.0, lsp-0.2.1
asyncio: mode=auto
collected 1 item                                                                                                                                                                                                                              

test_detect_invalid_json.py FE                                                                                                                                                                                                          [100%]

=================================================================================================================== ERRORS ====================================================================================================================
___________________________________________________________________________________________________ ERROR at teardown of test_capabilities ____________________________________________________________________________________________________

    def finalizer() -> None:
        """Yield again, to finalize."""
    
        async def async_finalizer() -> None:
            try:
                await gen_obj.__anext__()
            except StopAsyncIteration:
                pass
            else:
                msg = "Async generator fixture didn't stop."
                msg += "Yield only once."
                raise ValueError(msg)
    
>       event_loop.run_until_complete(async_finalizer())

/var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:296: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=True debug=False>
future = <Task cancelled coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.finalizer.<locals>.async_fina... /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:286>>

    def run_until_complete(self, future):
        """Run until the Future is done.
    
        If the argument is a coroutine, it is wrapped in a Task.
    
        WARNING: It would be disastrous to call run_until_complete()
        with the same coroutine twice -- it would wrap it in two
        different Tasks and that can't be good.
    
        Return the Future's result, or raise its exception.
        """
        self._check_closed()
        self._check_runnung()
    
        new_task = not futures.isfuture(future)
        future = tasks.ensure_future(future, loop=self)
        if new_task:
            # An exception is raised if the future didn't complete, so there
            # is no need to log the "destroy pending task" message
            future._log_destroy_pending = False
    
        future.add_done_callback(_run_until_complete_cb)
        try:
            self.run_forever()
        except:
            if new_task and future.done() and not future.cancelled():
                # The coroutine raised a BaseException. Consume the exception
                # to not log a warning, the caller doesn't have access to the
                # local task.
                future.exception()
            raise
        finally:
            future.remove_done_callback(_run_until_complete_cb)
        if not future.done():
            raise RuntimeError('Event loop stopped before Future completed.')
    
>       return future.result()
E       concurrent.futures._base.CancelledError

/usr/lib64/python3.7/asyncio/base_events.py:587: CancelledError
------------------------------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
------------------------------------------------------------------------------------------------------------ Captured stdout call -------------------------------------------------------------------------------------------------------------
cancel: <Task pending coro=<test_capabilities() running at /tmp/pytest-of-alex/pytest-9/test_detect_invalid_json0/test_detect_invalid_json.py:15> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bc1550>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
cancel: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:45> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f06d8b9dd50>()]>>
-------------------------------------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------------------------------------
ERROR    pygls.protocol:protocol.py:512 Error receiving data
Traceback (most recent call last):
  File "/var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/protocol.py", line 510, in data_received
    self._data_received(data)
  File "/var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/protocol.py", line 543, in _data_received
    object_hook=self._deserialize_message))
  File "/usr/lib64/python3.7/json/__init__.py", line 361, in loads
    return cls(**kw).decode(s)
  File "/usr/lib64/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
================================================================================================================== FAILURES ===================================================================================================================
______________________________________________________________________________________________________________ test_capabilities ______________________________________________________________________________________________________________

args = (), kwargs = {'client': <pytest_lsp.client.LanguageClient object at 0x7f06d8c18050>}, coro = <coroutine object test_capabilities at 0x7f06d8b23e60>
task = <Task cancelled coro=<test_capabilities() done, defined at /tmp/pytest-of-alex/pytest-9/test_detect_invalid_json0/test_detect_invalid_json.py:7>>

    @functools.wraps(func)
    def inner(*args, **kwargs):
        coro = func(*args, **kwargs)
        if not inspect.isawaitable(coro):
            pyfuncitem.warn(
                pytest.PytestWarning(
                    f"The test {pyfuncitem} is marked with '@pytest.mark.asyncio' "
                    "but it is not an async function. "
                    "Please remove asyncio marker. "
                    "If the test is not marked explicitly, "
                    "check for global markers applied via 'pytestmark'."
                )
            )
            return
        task = asyncio.ensure_future(coro, loop=_loop)
        try:
>           _loop.run_until_complete(task)

/var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:525: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <_UnixSelectorEventLoop running=False closed=False debug=False>, future = <Task cancelled coro=<test_capabilities() done, defined at /tmp/pytest-of-alex/pytest-9/test_detect_invalid_json0/test_detect_invalid_json.py:7>>

    def run_until_complete(self, future):
        """Run until the Future is done.
    
        If the argument is a coroutine, it is wrapped in a Task.
    
        WARNING: It would be disastrous to call run_until_complete()
        with the same coroutine twice -- it would wrap it in two
        different Tasks and that can't be good.
    
        Return the Future's result, or raise its exception.
        """
        self._check_closed()
        self._check_runnung()
    
        new_task = not futures.isfuture(future)
        future = tasks.ensure_future(future, loop=self)
        if new_task:
            # An exception is raised if the future didn't complete, so there
            # is no need to log the "destroy pending task" message
            future._log_destroy_pending = False
    
        future.add_done_callback(_run_until_complete_cb)
        try:
            self.run_forever()
        except:
            if new_task and future.done() and not future.cancelled():
                # The coroutine raised a BaseException. Consume the exception
                # to not log a warning, the caller doesn't have access to the
                # local task.
                future.exception()
            raise
        finally:
            future.remove_done_callback(_run_until_complete_cb)
        if not future.done():
            raise RuntimeError('Event loop stopped before Future completed.')
    
>       return future.result()
E       concurrent.futures._base.CancelledError

/usr/lib64/python3.7/asyncio/base_events.py:587: CancelledError
------------------------------------------------------------------------------------------------------------ Captured stdout setup ------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
--------------------------------------------------------------
task: <Task pending coro=<_wrap_asyncgen_fixture.<locals>._asyncgen_fixture_wrapper.<locals>.setup() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:280> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bba4d0>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
task: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:33>>
task: <Task pending coro=<aio_readline() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/server.py:61> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8b9dd10>()]>>
------------------------------------------------------------------------------------------------------------ Captured stdout call -------------------------------------------------------------------------------------------------------------
cancel: <Task pending coro=<test_capabilities() running at /tmp/pytest-of-alex/pytest-9/test_detect_invalid_json0/test_detect_invalid_json.py:15> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib64/python3.7/asyncio/futures.py:351, <TaskWakeupMethWrapper object at 0x7f06d8bc1550>()]> cb=[_run_until_complete_cb() at /usr/lib64/python3.7/asyncio/base_events.py:157]>
cancel: <Task pending coro=<check_server_process() running at /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_lsp/plugin.py:45> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f06d8b9dd50>()]>>
-------------------------------------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------------------------------------
ERROR    pygls.protocol:protocol.py:512 Error receiving data
Traceback (most recent call last):
  File "/var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/protocol.py", line 510, in data_received
    self._data_received(data)
  File "/var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pygls/protocol.py", line 543, in _data_received
    object_hook=self._deserialize_message))
  File "/usr/lib64/python3.7/json/__init__.py", line 361, in loads
    return cls(**kw).decode(s)
  File "/usr/lib64/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
============================================================================================================== warnings summary ===============================================================================================================
test_detect_invalid_json.py::test_capabilities
  /var/home/alex/Projects/lsp-devtools/lib/pytest-lsp/.py37/lib64/python3.7/site-packages/pytest_asyncio/plugin.py:446: DeprecationWarning: pytest-asyncio detected an unclosed event loop when tearing down the event_loop
  fixture: <_UnixSelectorEventLoop running=False closed=False debug=False>
  pytest-asyncio will close the event loop for you, but future versions of the
  library will no longer do so. In order to ensure compatibility with future
  versions, please make sure that:
      1. Any custom "event_loop" fixture properly closes the loop after yielding it
      2. Your code does not modify the event loop in async fixtures or tests
  
    DeprecationWarning,

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================================================================================== short test summary info ===========================================================================================================
FAILED test_detect_invalid_json.py::test_capabilities - concurrent.futures._base.CancelledError
ERROR test_detect_invalid_json.py::test_capabilities - concurrent.futures._base.CancelledError
==================================================================================================== 1 failed, 1 warning, 1 error in 0.97s ====================================================================================================

Not entirely sure why the event loop is not being closed by this test case....
I'm assuming it has something to do with cancelling tasks, but as far as I can tell it's not cancelling anything internal to pytest-asyncio?

@alcarney alcarney added help wanted Extra attention is needed pytest-lsp Issues affecting the pytest-lsp package labels Mar 24, 2023
@alcarney
Copy link
Member Author

alcarney commented May 5, 2023

This example maybe more complicated than necessary, see also pytest-dev/pytest-asyncio#541

@alcarney
Copy link
Member Author

This should now be resolved by openlawlibrary/pygls#336

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pytest-lsp Issues affecting the pytest-lsp package
Projects
None yet
Development

No branches or pull requests

1 participant