jupyter-server / jupyter_server

The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications.
https://jupyter-server.readthedocs.io
BSD 3-Clause "New" or "Revised" License
479 stars 291 forks source link

Tests failing in the latest version #1387

Open frenzymadness opened 7 months ago

frenzymadness commented 7 months ago

Description

I have a problem with version 2.12.5. I'm building it as an RPM package and two tests started to fail after the upgrade.

Output
=================================== FAILURES ===================================
__________________ test_kernel_action_success_event[shutdown] __________________

cls = 
func = . at 0x7fc450ce2840>
when = 'call'
reraise = (, )

    @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]":
        """Call func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

cls        = 
duration   = 0.01232880400493741
excinfo    = \n') tblen=7>
func       = . at 0x7fc450ce2840>
precise_start = 468464.58505128
precise_stop = 468464.597380084
reraise    = (, )
result     = None
start      = 1705472825.3292458
stop       = 1705472825.3415751
when       = 'call'

/usr/lib/python3.12/site-packages/_pytest/runner.py:341: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.12/site-packages/_pytest/runner.py:262: in 
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
        ihook      = 
        item       = 
        kwds       = {}
/usr/lib/python3.12/site-packages/pluggy/_hooks.py:493: in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
        firstresult = False
        kwargs     = {'item': }
        self       = 
/usr/lib/python3.12/site-packages/pluggy/_manager.py:115: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
        firstresult = False
        hook_name  = 'pytest_runtest_call'
        kwargs     = {'item': }
        methods    = [>, ...]
        self       = <_pytest.config.PytestPluginManager object at 0x7fc455d01f70>
/usr/lib/python3.12/site-packages/_pytest/unraisableexception.py:88: in pytest_runtest_call
    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: 
E               
E               Traceback (most recent call last):
E                 File "/usr/lib/python3.12/site-packages/traitlets/traitlets.py", line 626, in get
E                   value = obj._trait_values[self.name]  # type: ignore
E                           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^
E               KeyError: 'event_logger'
E               
E               During handling of the above exception, another exception occurred:
E               
E               Traceback (most recent call last):
E                 File "/usr/lib64/python3.12/site-packages/yaml/resolver.py", line 143, in resolve
E                   def resolve(self, kind, value, implicit):
E                   
E               ResourceWarning: unclosed 

cm         = <_pytest.unraisableexception.catch_unraisable_exception object at 0x7fc4517d8d70>
err_msg    = 'Exception ignored in'
msg        = 'Exception ignored in: \n\nTraceback (most recent call last):\n  File ...nclosed \n'

/usr/lib/python3.12/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning
------------------------------ Captured log call -------------------------------
ERROR    asyncio:base_events.py:1805 Task was destroyed but it is pending!
task:  wait_for=.() at /usr/lib64/python3.12/site-packages/tornado/ioloop.py:685, Task.__wakeup()]> cb=[IOLoop.add_future..() at /usr/lib64/python3.12/site-packages/tornado/ioloop.py:692]>
ERROR    asyncio:base_events.py:1805 Task was destroyed but it is pending!
task:  wait_for=.() at /usr/lib64/python3.12/site-packages/tornado/ioloop.py:685, Task.__wakeup()]> cb=[IOLoop.add_future..() at /usr/lib64/python3.12/site-packages/tornado/ioloop.py:692]>
ERROR    asyncio:base_events.py:1805 Task was destroyed but it is pending!
task:  wait_for=.() at /usr/lib64/python3.12/site-packages/tornado/ioloop.py:685, Task.__wakeup()]> cb=[IOLoop.add_future..() at /usr/lib64/python3.12/site-packages/tornado/ioloop.py:692]>
________________________________ test_get_spec _________________________________

cls = 
func = . at 0x7fc45094a8e0>
when = 'call'
reraise = (, )

    @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]":
        """Call func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

cls        = 
duration   = 0.014410024043172598
excinfo    = \n') tblen=7>
func       = . at 0x7fc45094a8e0>
precise_start = 468527.643731226
precise_stop = 468527.65814125
reraise    = (, )
result     = None
start      = 1705472888.3879254
stop       = 1705472888.402336
when       = 'call'

/usr/lib/python3.12/site-packages/_pytest/runner.py:341: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.12/site-packages/_pytest/runner.py:262: in 
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
        ihook      = 
        item       = 
        kwds       = {}
/usr/lib/python3.12/site-packages/pluggy/_hooks.py:493: in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
        firstresult = False
        kwargs     = {'item': }
        self       = 
/usr/lib/python3.12/site-packages/pluggy/_manager.py:115: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
        firstresult = False
        hook_name  = 'pytest_runtest_call'
        kwargs     = {'item': }
        methods    = [>, ...]
        self       = <_pytest.config.PytestPluginManager object at 0x7fc455d01f70>
/usr/lib/python3.12/site-packages/_pytest/unraisableexception.py:88: in pytest_runtest_call
    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: 
E               
E               Traceback (most recent call last):
E                 File "/usr/lib64/python3.12/contextlib.py", line 132, in __enter__
E                   def __enter__(self):
E                   
E               ResourceWarning: unclosed 

cm         = <_pytest.unraisableexception.catch_unraisable_exception object at 0x7fc4507af650>
err_msg    = 'Exception ignored in'
msg        = 'Exception ignored in: \n\nTraceback (most recent call last):\n  File ...nclosed \n'

/usr/lib/python3.12/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning
---------------------------- Captured stderr setup -----------------------------
[D 2024-01-17 07:28:08.374 ServerApp] Config changed: {'ServerApp': {'sock': '/tmp/jupyter_server.1311.sock', 'allow_remote_access': True, 'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': }}
------------------------------ Captured log setup ------------------------------
DEBUG    ServerApp:application.py:457 Config changed: {'ServerApp': {'sock': '/tmp/jupyter_server.1311.sock', 'allow_remote_access': True, 'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': }}
DEBUG    ServerApp:application.py:190 Searching ['/tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/config', '/builddir/.local/etc/jupyter', '/tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/env/etc/jupyter', '/tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/etc/jupyter'] for config files
DEBUG    ServerApp:application.py:908 Looking for jupyter_config in /tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_config in /tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/env/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_config in /builddir/.local/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_config in /tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/config
DEBUG    ServerApp:application.py:457 Config changed: {'ServerApp': {'sock': '/tmp/jupyter_server.1311.sock', 'allow_remote_access': True, 'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': }}
DEBUG    ServerApp:application.py:908 Looking for jupyter_server_config in /tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_server_config in /tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/env/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_server_config in /builddir/.local/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_server_config in /tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/config
DEBUG    ServerApp:application.py:457 Config changed: {'ServerApp': {'sock': '/tmp/jupyter_server.1311.sock', 'allow_remote_access': True, 'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': }}
DEBUG    ServerApp:application.py:457 Config changed: {'ServerApp': {'sock': '/tmp/jupyter_server.1311.sock', 'allow_remote_access': True, 'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': }}
INFO     ServerApp:serverapp.py:2852 Serving notebooks from local directory: /tmp/pytest-of-mockbuild/pytest-0/test_get_spec1/root_dir
INFO     ServerApp:serverapp.py:2852 Jupyter Server 2.12.5 is running at:
INFO     ServerApp:serverapp.py:2852 http+unix://%2Ftmp%2Fjupyter_server.1311.sock/a%40b/?token=7ab7736fe6f2e3c599a014000cb5d555a57ad4267c53f76a
INFO     ServerApp:serverapp.py:2852     http+unix://%2Ftmp%2Fjupyter_server.1311.sock/a%40b/?token=7ab7736fe6f2e3c599a014000cb5d555a57ad4267c53f76a
INFO     ServerApp:serverapp.py:2853 Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
CRITICAL ServerApp:serverapp.py:2881 

Jupyter Server is listening on http+unix://%2Ftmp%2Fjupyter_server.1311.sock/a%40b/?token=7ab7736fe6f2e3c599a014000cb5d555a57ad4267c53f76a
    http+unix://%2Ftmp%2Fjupyter_server.1311.sock/a%40b/?token=7ab7736fe6f2e3c599a014000cb5d555a57ad4267c53f76a

UNIX sockets are not browser-connectable, but you can tunnel to the instance via e.g.`ssh -L 8888:/tmp/jupyter_server.1311.sock -N user@this_host` and then open e.g. http+unix://%2Ftmp%2Fjupyter_server.1311.sock/a%40b/ in a browser.
------------------------------ Captured log call -------------------------------
ERROR    asyncio:base_events.py:1805 Task was destroyed but it is pending!
task:  wait_for=.() at /usr/lib64/python3.12/site-packages/tornado/ioloop.py:685, Task.__wakeup()]> cb=[IOLoop.add_future..() at /usr/lib64/python3.12/site-packages/tornado/ioloop.py:692]>
ERROR    asyncio:base_events.py:1805 Task was destroyed but it is pending!
task:  wait_for= cb=[IOLoop.add_future..() at /usr/lib64/python3.12/site-packages/tornado/ioloop.py:692]>
ERROR    asyncio:base_events.py:1805 Task was destroyed but it is pending!
task:  wait_for=.finish() at /builddir/build/BUILD/jupyter_server-2.12.5/jupyter_server/services/kernels/connection/channels.py:189, <1 more>, Task.__wakeup()]> cb=[_HandlerDelegate.execute..() at /usr/lib64/python3.12/site-packages/tornado/web.py:2438]>
INFO     ServerApp:log.py:98 302 GET /a%40b/api/spec.yaml (@0.0.0.0) 0.44ms
DEBUG    ServerApp:handlers.py:326 Using contents: services/contents
DEBUG    ServerApp:log.py:98 200 GET /a%40b/login?next=%2Fa%2540b%2Fapi%2Fspec.yaml (@0.0.0.0) 9.40ms
---------------------------- Captured log teardown -----------------------------
INFO     ServerApp:serverapp.py:2635 Shutting down 1 extension
DEBUG    ServerApp:manager.py:372 jupyter_server_terminals | extension app 'jupyter_server_terminals' stopping
DEBUG    ServerApp:manager.py:374 jupyter_server_terminals | extension app 'jupyter_server_terminals' stopped
===Flaky Test Report===

test_culling_config passed 1 out of the required 1 times. Success!
test_culling passed 1 out of the required 1 times. Success!
test_connection[jp_server_config0] passed 1 out of the required 1 times. Success!
test_connection[jp_server_config1] passed 1 out of the required 1 times. Success!
test_connection[jp_server_config2] passed 1 out of the required 1 times. Success!
test_restart_kernel[jp_server_config0] passed 1 out of the required 1 times. Success!
test_restart_kernel[jp_server_config1] passed 1 out of the required 1 times. Success!
test_restart_kernel[jp_server_config2] failed (1 runs remaining out of 2).
    
    Exception ignored in: 

Traceback (most recent call last):
  File "/usr/lib64/python3.12/site-packages/tornado/platform/asyncio.py", line 225, in add_callback
    call_soon(self._run_callback, functools.partial(callback, *args, **kwargs))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: unclosed 

    [, , , , , , ]
test_restart_kernel[jp_server_config2] passed 1 out of the required 1 times. Success!
test_restart_kernel[jp_server_config3] failed (1 runs remaining out of 2).
    
    Exception ignored in: 

Traceback (most recent call last):
  File "/usr/lib64/python3.12/asyncio/selector_events.py", line 278, in _add_reader
    key = self._selector.get_key(fd)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/selectors.py", line 192, in get_key
    raise KeyError("{!r} is not registered".format(fileobj)) from None
KeyError: '45 is not registered'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.12/selectors.py", line 351, in register
    def register(self, fileobj, events, data=None):

ResourceWarning: unclosed 

    [, , , , , , ]
test_restart_kernel[jp_server_config3] passed 1 out of the required 1 times. Success!

===End Flaky Test Report===
============================= slowest 10 durations =============================
12.47s call     tests/services/kernels/test_cull.py::test_cull_idle_disable
12.11s call     tests/test_terminal.py::test_culling
7.46s call     tests/services/kernels/test_cull.py::test_cull_idle[jp_server_config0]
7.44s call     tests/services/kernels/test_cull.py::test_cull_idle[jp_server_config1]
5.07s call     tests/test_terminal.py::test_terminal_create_with_cwd
3.11s call     tests/services/sessions/test_manager.py::test_pending_kernel
1.22s teardown tests/services/kernels/test_connection.py::test_websocket_connection
1.12s teardown tests/services/sessions/test_api.py::test_restart_kernel[jp_server_config0]
1.11s teardown tests/services/sessions/test_api.py::test_restart_kernel[jp_server_config1]
1.11s teardown tests/services/sessions/test_api.py::test_restart_kernel[jp_server_config3]
=========================== short test summary info ============================
SKIPPED [1] tests/test_terminal.py:161: Not yet working
SKIPPED [1] tests/test_terminal.py:198: Not yet working
SKIPPED [1] tests/nbconvert/test_handlers.py:48: Command 'pandoc' is not available
SKIPPED [1] tests/nbconvert/test_handlers.py:77: Command 'pandoc' is not available
SKIPPED [1] tests/nbconvert/test_handlers.py:90: Command 'pandoc' is not available
SKIPPED [1] tests/nbconvert/test_handlers.py:104: Command 'pandoc' is not available
SKIPPED [1] tests/nbconvert/test_handlers.py:117: Command 'pandoc' is not available
SKIPPED [1] tests/nbconvert/test_handlers.py:136: Command 'pandoc' is not available
SKIPPED [7] tests/conftest.py:42: Skipping this test because it's marked 'integration_test'. Run integration tests using the `--integration_tests` flag.
FAILED tests/services/kernels/test_events.py::test_kernel_action_success_event[shutdown] - pytest.PytestUnraisableExceptionWarning: Exception ignored in: 

It seems to be related to this change https://github.com/jupyter-server/jupyter_server/commit/a3a9d3deea7a798d13fe09a41e53f6f825caf21b where the configuration for filterwarnings was adjusted.

I've tested it and it might be a little bit flaky. test_get_spec fails for me every time but sometimes test_cull_dead[jp_server_config0] fails instead of test_kernel_action_success_event[shutdown].

frenzymadness commented 7 months ago

Adding -W "always:unclosed <socket.socket:ResourceWarning" workarounds the problem for me.

blink1073 commented 7 months ago

So far it has been passing in our environments, we can't support -W error everywhere.

frenzymadness commented 1 month ago

I have a similar problem now when building the RPM package with version 2.14.1 and Python 3.13 beta 2:

==================================== ERRORS ====================================
____________ ERROR at setup of test_gateway_kernel_lifecycle[False] ____________

>       lambda: ihook(item=item, **kwds), when=when, reraise=reraise
    )
E   pytest.PytestUnraisableExceptionWarning: Exception ignored in: <sqlite3.Connection object at 0x7f34cc959c60>
E   
E   Traceback (most recent call last):
E     File "/usr/lib/python3.13/site-packages/traitlets/traitlets.py", line 1798, in class_traits
E       for name, trait in traits.items():
E                          ~~~~~~~~~~~~^^
E   ResourceWarning: unclosed database in <sqlite3.Connection object at 0x7f34cc959c60>

ihook      = <HookCaller 'pytest_runtest_setup'>
item       = <Function test_gateway_kernel_lifecycle[False]>
kwds       = {}

/usr/lib/python3.13/site-packages/flaky/flaky_pytest_plugin.py:146: PytestUnraisableExceptionWarning
---------------------------- Captured stderr setup -----------------------------
[D 2024-07-03 14:36:08.852 ServerApp] Config changed: {'CustomTestTokenRenewer': {'config_var_1': 42, 'config_var_2': 'Use this token value: '}, 'ServerApp': {'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': <LazyConfigValue {}>}}
------------------------------ Captured log setup ------------------------------
DEBUG    ServerApp:application.py:457 Config changed: {'CustomTestTokenRenewer': {'config_var_1': 42, 'config_var_2': 'Use this token value: '}, 'ServerApp': {'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': <LazyConfigValue {}>}}
DEBUG    ServerApp:application.py:194 Searching ['/tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/config', '/builddir/.local/etc/jupyter', '/tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/env/etc/jupyter', '/tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/etc/jupyter'] for config files
DEBUG    ServerApp:application.py:908 Looking for jupyter_config in /tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_config in /tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/env/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_config in /builddir/.local/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_config in /tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/config
DEBUG    ServerApp:application.py:457 Config changed: {'CustomTestTokenRenewer': {'config_var_1': 42, 'config_var_2': 'Use this token value: '}, 'ServerApp': {'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': <LazyConfigValue {}>}}
DEBUG    ServerApp:application.py:908 Looking for jupyter_server_config in /tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_server_config in /tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/env/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_server_config in /builddir/.local/etc/jupyter
DEBUG    ServerApp:application.py:908 Looking for jupyter_server_config in /tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/config
DEBUG    ServerApp:application.py:457 Config changed: {'CustomTestTokenRenewer': {'config_var_1': 42, 'config_var_2': 'Use this token value: '}, 'ServerApp': {'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': <LazyConfigValue {}>}}
DEBUG    ServerApp:application.py:457 Config changed: {'CustomTestTokenRenewer': {'config_var_1': 42, 'config_var_2': 'Use this token value: '}, 'ServerApp': {'jpserver_extensions': {'jupyter_server_terminals': True}}, 'NotebookNotary': {'db_file': ':memory:'}, 'IdentityProvider': {'token': <LazyConfigValue {}>}}
INFO     ServerApp:serverapp.py:3004 Serving notebooks from local directory: /tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/root_dir
INFO     ServerApp:serverapp.py:3004 Jupyter Server 2.14.1 is running at:
INFO     ServerApp:serverapp.py:3004 http://localhost:34399/a%40b/?token=32ee5219deaae093a9e9352ca6b18f1c878314be90a336a8
INFO     ServerApp:serverapp.py:3004     http://127.0.0.1:34399/a%40b/?token=32ee5219deaae093a9e9352ca6b18f1c878314be90a336a8
INFO     ServerApp:serverapp.py:3004 Kernels will be managed by the Gateway server running at:
INFO     ServerApp:serverapp.py:3004 http://mock-gateway-server:8889
INFO     ServerApp:serverapp.py:3005 Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
CRITICAL ServerApp:serverapp.py:3067 

To access the server, open this file in a browser:
    file:///tmp/pytest-of-mockbuild/pytest-0/test_gateway_kernel_lifecycle_0/runtime/jpserver-1339-open.html
Or copy and paste one of these URLs:
    http://localhost:34399/a%40b/?token=32ee5219deaae093a9e9352ca6b18f1c878314be90a336a8
    http://127.0.0.1:34399/a%40b/?token=32ee5219deaae093a9e9352ca6b18f1c878314be90a336a8
============================= slowest 10 durations =============================
0.07s setup    tests/test_files.py::test_file_types[jupyter_server.files.handlers.FilesHandler]
0.04s call     tests/test_files.py::test_contents_manager[jupyter_server.files.handlers.FilesHandler]
0.03s setup    tests/test_files.py::test_file_types[jupyter_server.base.handlers.AuthenticatedFileHandler]
0.03s setup    tests/test_files.py::test_old_files_redirect[jupyter_server.files.handlers.FilesHandler]
0.03s setup    tests/test_files.py::test_save_hooks[jupyter_server.files.handlers.FilesHandler]
0.03s setup    tests/test_files.py::test_hidden_files[maybe_hidden0-jupyter_server.base.handlers.AuthenticatedFileHandler]
0.03s setup    tests/test_gateway.py::test_gateway_get_named_kernelspec
0.03s setup    tests/test_gateway.py::test_gateway_session_lifecycle[True]
0.03s setup    tests/test_gateway.py::test_gateway_kernel_lifecycle[False]
0.03s setup    tests/test_files.py::test_hidden_files[maybe_hidden3-jupyter_server.base.handlers.AuthenticatedFileHandler]
=========================== short test summary info ============================
ERROR tests/test_gateway.py::test_gateway_kernel_lifecycle[False] - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <sqlite3.Con...
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
========================= 37 passed, 1 error in 2.77s ==========================
frenzymadness commented 1 month ago

And ignoring PytestUnraisableExceptionWarning workarounds the problem for me.