jupyter_server
jupyter_server copied to clipboard
Pending Kernels and Windows Unit tests
Jupyter Server's unit tests involving pending kernels are failing on Windows in CI—I haven't tested locally.
It might take me some time to fix the issue, especially since I don't have a Windows machine. In the meantime, I mentioned in today's Jupyter Server meeting that we temporarily skip these tests in CI.
I'm opening this issue to track/ensure that we don't forget to fix this issue.
@vidartf, not urgent, but would you mind trying to run Jupyter Server's unit tests with the latest release of jupyter_client and seeing if the tests hang when they reach the pending kernels tests?
Hard to tell, as my entire terminal window closes after running a few tests. I'll try to see if I can narrow down which test(s) are causing this to happen.
The terminal window closing problem seem unrelated/spurious. Some observations on the tests (need to finish for today):
- Some sessions tests create a lot of these warnings:
Task was destroyed but it is pending! task: <Task pending name='Task-559' coro=<WebSocketProtocol13._receive_frame_loop() running at C:\cleanconda\envs\server-dev\lib\site-packages\tornado\websocket.py:1116> wait_for=<Future pending cb=[IOLoop.add_future.<locals>.<lambda>() at C:\cleanconda\envs\server-dev\lib\site-packages\tornado\ioloop.py:688, <TaskWakeupMethWrapper object at 0x0000026A2FDEDD60>()]> cb=[IOLoop.add_future.<locals>.<lambda>() at C:\cleanconda\envs\server-dev\lib\site-packages\tornado\ioloop.py:688]> - All the nbconvert tests fail with
ValueError: No template sub-directory with name 'lab' found in the following paths:. Even though I did installpip install jupyter-server[test]. - tests.test_terminal.test_culling always fails.
- The services.kernels.test_api tests have a tendency to hang the pytest process so it needs to be force killed. I assume these are the tests that you were having issues with. I will do some more runs tomorrow to see if I can narrow things a bit.
Resuming work here, I now see a bunch of these errors in test_authorizer:
_________________ ERROR at setup of test_authorized_requests[True-GET-/api/kernelspecs/{kernelspec}-None] _________________
cls = <class '_pytest.runner.CallInfo'>, func = <function call_runtest_hook.<locals>.<lambda> at 0x0000021B0490BE20>
when = 'setup', reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
@classmethod
def from_call(
cls,
func: "Callable[[], TResult]",
when: "Literal['collect', 'setup', 'call', 'teardown']",
reraise: Optional[
Union[Type[BaseException], Tuple[Type[BaseException], ...]]
] = None,
) -> "CallInfo[TResult]":
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: Optional[TResult] = func()
<env-root>\lib\site-packages\_pytest\runner.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
<env-root>\lib\site-packages\_pytest\runner.py:255: in <lambda>
lambda: ihook(item=item, **kwds), when=when, reraise=reraise
<env-root>\lib\site-packages\pluggy\_hooks.py:265: in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
<env-root>\lib\site-packages\pluggy\_manager.py:80: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
<env-root>\lib\site-packages\_pytest\unraisableexception.py:83: in pytest_runtest_setup
yield from unraisable_exception_runtest_hook()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def unraisable_exception_runtest_hook() -> Generator[None, None, None]:
with catch_unraisable_exception() as cm:
yield
if cm.unraisable:
if cm.unraisable.err_msg is not None:
err_msg = cm.unraisable.err_msg
else:
err_msg = "Exception ignored in"
msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
msg += "".join(
traceback.format_exception(
cm.unraisable.exc_type,
cm.unraisable.exc_value,
cm.unraisable.exc_traceback,
)
)
> warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E pytest.PytestUnraisableExceptionWarning: Exception ignored in: <function Context.__del__ at 0x0000021B015280D0>
E
E Traceback (most recent call last):
E File "<env-root>\lib\site-packages\zmq\sugar\context.py", line 65, in __del__
E warnings.warn(
E ResourceWarning: unclosed context <zmq.asyncio.Context() at 0x21b0492ed40>
<env-root>\lib\site-packages\_pytest\unraisableexception.py:78: PytestUnraisableExceptionWarning
I believe this is telling us two things:
- Calling warnings.warn in
__del__is not really ok, as depending on the warning filter it might be an exception (and in my case they seem to be causing exceptions). - When the ZMQ context is garbage collected it is complaining about not having been closed. I'm not sure if this is expected during test runs?
Yes, the warning is in pyzmq itself, and is a result of us not properly closing contexts in some cases. Hopefully this will all be resolved as part of ongoing asyncio refactoring, e.g. https://github.com/jupyter/jupyter_client/issues/755
The only tests we're skipping on Windows currently are related to files or unix sockets, closing as fixed.