Skip to content

Commit 3bc3815

Browse files
committed
adjust tests to capture changes
1 parent cafb327 commit 3bc3815

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

jupyter_server/extension/application.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ def _prepare_config(self):
283283
"""Builds a Config object from the extension's traits and passes
284284
the object to the webapp's settings as `<extension_name>_config`.
285285
"""
286+
self.update_config(self.config)
286287
traits = self.class_own_traits().keys()
287288
self.extension_config = Config({t: getattr(self, t) for t in traits})
288289
self.settings['{}_config'.format(self.extension_name)] = self.extension_config
@@ -365,7 +366,7 @@ def initialize_server(cls, argv=[], load_other_extensions=True, **kwargs):
365366
serverapp.initialize(argv=argv, load_extensions=load_other_extensions)
366367
return serverapp
367368

368-
def initialize(self, serverapp, argv=[]):
369+
def initialize(self, serverapp, argv=None):
369370
"""Initialize the extension app.
370371
371372
This method:
@@ -378,6 +379,12 @@ def initialize(self, serverapp, argv=[]):
378379
# Initialize ServerApp.
379380
self.serverapp = serverapp
380381

382+
# If argv is given, parse and update config.
383+
if argv:
384+
self.parse_command_line(argv)
385+
# Load config from file.
386+
self.load_config_file()
387+
381388
# Initialize config, settings, templates, and handlers.
382389
self._prepare_config()
383390
self._prepare_templates()

jupyter_server/serverapp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ def init_server_extension_config(self):
14931493
app_obj = metadata[0].get('app', None)
14941494
if app_obj:
14951495
if not issubclass(app_obj, JupyterApp):
1496-
raise TypeError(abb_obj.__name__ + "must be a subclass of JupyterApp")
1496+
raise TypeError(abb_obj.__name__ + " must be a subclass of JupyterApp.")
14971497
# Initialize extension app
14981498
app = app_obj(parent=self)
14991499
# Update the app's config, setting

tests/extension/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ def _jupyter_server_extension_paths():
4242
}]
4343

4444
@pytest.fixture
45-
def make_mock_extension_app(template_dir):
45+
def make_mock_extension_app(template_dir, config_dir):
4646
def _make_mock_extension_app(**kwargs):
4747
kwargs.setdefault('template_paths', [str(template_dir)])
48-
return MockExtensionApp(**kwargs)
48+
return MockExtensionApp(config_dir=str(config_dir), **kwargs)
4949

5050
# TODO Should the index template creation be only be done only once?
51-
index = template_dir.joinpath("index.html")
51+
index = template_dir.joinpath("index.html")
5252
index.write_text("""
5353
<!DOCTYPE HTML>
5454
<html>

0 commit comments

Comments
 (0)