From 055a1695ba0aa0718764541b503bb0b5871e69c5 Mon Sep 17 00:00:00 2001 From: Divyansh Choudhary Date: Tue, 23 Apr 2024 15:16:27 +0530 Subject: [PATCH] Move ENV_CONFIG_PATH import back into _get_config_manager (#450) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move ENV_CONFIG_PATH import back into _get_config_manager We move the import for ENV_CONFIG_PATH back into the _get_config_manager function so that patches applied in jupyterlab tests are correctly reflected * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add back a comment --------- Co-authored-by: Divyansh Choudhary Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: MichaƂ Krassowski <5832902+krassowski@users.noreply.github.com> --- jupyterlab_server/config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jupyterlab_server/config.py b/jupyterlab_server/config.py index faf57cd..d58c8a4 100644 --- a/jupyterlab_server/config.py +++ b/jupyterlab_server/config.py @@ -13,7 +13,7 @@ from typing import Any import json5 -from jupyter_core.paths import ENV_CONFIG_PATH, SYSTEM_CONFIG_PATH, jupyter_config_dir, jupyter_path +from jupyter_core.paths import SYSTEM_CONFIG_PATH, jupyter_config_dir, jupyter_path from jupyter_server.services.config.manager import ConfigManager, recursive_update from jupyter_server.utils import url_path_join as ujoin from traitlets import Bool, HasTraits, List, Unicode, default @@ -370,6 +370,9 @@ def _get_config_manager(level: str, include_higher_levels: bool = False) -> Conf """Get the location of config files for the current context Returns the string to the environment """ + # Delayed import since this gets monkey-patched in tests + from jupyter_core.paths import ENV_CONFIG_PATH + allowed = get_allowed_levels() if level not in allowed: msg = f"Page config level must be one of: {allowed}"