From b159cbfeefbe13f963dbaa4e5bc6faa4d5a85679 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 14 Jul 2022 09:09:25 -0700 Subject: [PATCH 1/3] unpin nbclassic 0.4.3 is out, see if it fixes things --- dev-requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index d61f287d..53eb288e 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -12,8 +12,7 @@ mock # nbclassic provides the '/tree/' handler, which we use in tests # it is a transitive dependency via jupyterlab, # but depend on it directly -# 0.4 introduces some installation/loading problems (check again after 0.4.3) -nbclassic<0.4 +nbclassic pre-commit pytest>=3.3 pytest-asyncio; python_version < "3.7" From eab6a1a1124dc3a7e8a655be34211c4a9fba4ab9 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 14 Jul 2022 20:34:07 -0700 Subject: [PATCH 2/3] typo in jinja env name use loop variable, not hardcoded string --- jupyterhub/singleuser/mixins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyterhub/singleuser/mixins.py b/jupyterhub/singleuser/mixins.py index 16bd259e..6f52dbfd 100755 --- a/jupyterhub/singleuser/mixins.py +++ b/jupyterhub/singleuser/mixins.py @@ -754,7 +754,7 @@ class SingleUserNotebookAppMixin(Configurable): if env_name in settings: # when running with jupyter-server, classic notebook (nbclassic server extension or notebook v7) # gets its own jinja env, which needs the same patch - jinja_envs.append(settings['notebook_jinja2_env']) + jinja_envs.append(settings[env_name]) # patch jinja env loading to get modified template, only for base page.html def get_page(name): From cef241a80bd4cc52e52e3b09513d24697983e01f Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 14 Jul 2022 20:50:46 -0700 Subject: [PATCH 3/3] test: handle possibility that notebook is unavailable no longer a strict dependency of other test deps --- jupyterhub/tests/test_singleuser.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/jupyterhub/tests/test_singleuser.py b/jupyterhub/tests/test_singleuser.py index 1a870d59..d41a63f9 100644 --- a/jupyterhub/tests/test_singleuser.py +++ b/jupyterhub/tests/test_singleuser.py @@ -195,10 +195,22 @@ def test_singleuser_app_class(JUPYTERHUB_SINGLEUSER_APP): import jupyter_server # noqa except ImportError: have_server = False - expect_error = "jupyter_server" in JUPYTERHUB_SINGLEUSER_APP else: have_server = True - expect_error = False + try: + import notebook.notebookapp # noqa + except ImportError: + have_notebook = False + else: + have_notebook = True + + if JUPYTERHUB_SINGLEUSER_APP.startswith("notebook."): + expect_error = not have_notebook + elif JUPYTERHUB_SINGLEUSER_APP.startswith("jupyter_server."): + expect_error = not have_server + else: + # not specified, will try both + expect_error = not (have_server or have_notebook) if expect_error: ctx = pytest.raises(CalledProcessError)