Skip to content

Commit

Permalink
adjust tests to capture changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsailer committed Feb 28, 2020
1 parent cafb327 commit 3bc3815
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion jupyter_server/extension/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ def _prepare_config(self):
"""Builds a Config object from the extension's traits and passes
the object to the webapp's settings as `<extension_name>_config`.
"""
self.update_config(self.config)
traits = self.class_own_traits().keys()
self.extension_config = Config({t: getattr(self, t) for t in traits})
self.settings['{}_config'.format(self.extension_name)] = self.extension_config
Expand Down Expand Up @@ -365,7 +366,7 @@ def initialize_server(cls, argv=[], load_other_extensions=True, **kwargs):
serverapp.initialize(argv=argv, load_extensions=load_other_extensions)
return serverapp

def initialize(self, serverapp, argv=[]):
def initialize(self, serverapp, argv=None):
"""Initialize the extension app.
This method:
Expand All @@ -378,6 +379,12 @@ def initialize(self, serverapp, argv=[]):
# Initialize ServerApp.
self.serverapp = serverapp

# If argv is given, parse and update config.
if argv:
self.parse_command_line(argv)
# Load config from file.
self.load_config_file()

# Initialize config, settings, templates, and handlers.
self._prepare_config()
self._prepare_templates()
Expand Down
2 changes: 1 addition & 1 deletion jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ def init_server_extension_config(self):
app_obj = metadata[0].get('app', None)
if app_obj:
if not issubclass(app_obj, JupyterApp):
raise TypeError(abb_obj.__name__ + "must be a subclass of JupyterApp")
raise TypeError(abb_obj.__name__ + " must be a subclass of JupyterApp.")
# Initialize extension app
app = app_obj(parent=self)
# Update the app's config, setting
Expand Down
6 changes: 3 additions & 3 deletions tests/extension/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ def _jupyter_server_extension_paths():
}]

@pytest.fixture
def make_mock_extension_app(template_dir):
def make_mock_extension_app(template_dir, config_dir):
def _make_mock_extension_app(**kwargs):
kwargs.setdefault('template_paths', [str(template_dir)])
return MockExtensionApp(**kwargs)
return MockExtensionApp(config_dir=str(config_dir), **kwargs)

# TODO Should the index template creation be only be done only once?
index = template_dir.joinpath("index.html")
index = template_dir.joinpath("index.html")
index.write_text("""
<!DOCTYPE HTML>
<html>
Expand Down

0 comments on commit 3bc3815

Please sign in to comment.