Check internal functions#

from nbproject import header
header()
idIyjiKeXJhQhA
version0
time_init2022-08-25 18:37
time_run2024-02-28 16:55
pypackagenbproject==0.10.1 pytest==8.0.2

Utilities to communicate with jupyter frontend.

from nbproject.dev._frontend_commands import _save_notebook, _reload_notebook
from nbproject.dev._jupyter_lab_commands import _lab_notebook_path

Here nothing should happen in the test environment.

_save_notebook(env="lab")
_save_notebook(env="notebook")
_reload_notebook(env="lab")
_reload_notebook(env="notebook")

Can’t get the path through ipylab, because we are not in juypter lab.

assert _lab_notebook_path() is None

Utilities to communicate with jupyter backend.

from nbproject.dev._jupyter_communicate import (
    notebook_path,
    prepare_url,
    query_server,
    running_servers,
)
servers_nbapp, servers_juserv = running_servers()

assert list(servers_nbapp) == []
assert list(servers_juserv) == []
❗ It looks like you are running jupyter lab but don't have jupyter-server module installed. Please install it via pip install jupyter-server
server = dict(token="test", url="localhost/")
assert (
    prepare_url(server, "/test_query")
    == "localhost/api/sessions/test_query?token=test"  # noqa
)
from pytest import raises

with raises(Exception):
    query_server(server)