diff --git a/jupyter_server/serverapp.py b/jupyter_server/serverapp.py index 01489e3dc..e4fc38dda 100644 --- a/jupyter_server/serverapp.py +++ b/jupyter_server/serverapp.py @@ -1755,7 +1755,11 @@ def _default_info_file(self) -> str: return os.path.join(self.runtime_dir, info_file) no_browser_open_file = Bool( - False, help="If True, do not write redirect HTML file disk, or show in messages." + False, + config=True, + help=_i18n( + "If True, do not write redirect HTML file disk, or show in startup output messages." + ), ) browser_open_file = Unicode() diff --git a/tests/test_serverapp.py b/tests/test_serverapp.py index eb137b12d..56f97e86c 100644 --- a/tests/test_serverapp.py +++ b/tests/test_serverapp.py @@ -607,7 +607,7 @@ def test_running_server_info(jp_serverapp): @pytest.mark.parametrize("should_exist", [True, False]) -async def test_browser_open_files(jp_configurable_serverapp, should_exist, caplog): +async def test_no_browser_open_file(jp_configurable_serverapp, should_exist, caplog): app = jp_configurable_serverapp(no_browser_open_file=not should_exist) await app._post_start() assert os.path.exists(app.browser_open_file) == should_exist @@ -616,6 +616,13 @@ async def test_browser_open_files(jp_configurable_serverapp, should_exist, caplo assert url_messages if should_exist else not url_messages +@pytest.mark.parametrize("should_exist", [True, False]) +def test_no_browser_open_file_cli(jp_configurable_serverapp, should_exist): + argv = ["--ServerApp.no_browser_open_file=" + str(should_exist)] + app = jp_configurable_serverapp(argv=argv) + assert app.no_browser_open_file == should_exist + + def test_deprecated_notebook_dir_priority(jp_configurable_serverapp, tmp_path): notebook_dir = tmp_path / "notebook" notebook_dir.mkdir()