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" 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): 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)