Skip to content

Commit 5b433fa

Browse files
authored
Merge pull request #5 from Zsailer/release-prep
Port missing logic and get unit tests working
2 parents 4e3a0a8 + eb60fc2 commit 5b433fa

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

notebook_shim/nbserver.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,21 @@ def sorted_extensions(self):
115115
config_dirs = jupyter_paths + [serverapp.config_dir]
116116
nbserver_extensions = get_nbserver_extensions(config_dirs)
117117

118+
# Link all extensions found in the old locations for
119+
# notebook server extensions.
120+
for name, enabled in nbserver_extensions.items():
121+
# If the extension is already enabled in the manager, i.e.
122+
# because it was discovered already by Jupyter Server
123+
# through its jupyter_server_config, then don't re-enable here.
124+
if name not in manager.extensions:
125+
successful = manager.add_extension(name, enabled=enabled)
126+
if successful:
127+
logger.info(
128+
"{name} | extension was found and enabled by notebook_shim. "
129+
"Consider moving the extension to Jupyter Server's "
130+
"extension paths.".format(name=name)
131+
)
132+
manager.link_extension(name)
118133

119134
def _load_jupyter_server_extension(serverapp):
120135
# Patch the config service manager to find the

notebook_shim/tests/mockextension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def _jupyter_server_extension_points():
1212
return [
1313
{
14-
"module": "notebook_shim.tests.shim.mockextension",
14+
"module": "notebook_shim.tests.mockextension",
1515
"app": MockExtensionApp
1616
}
1717
]

notebook_shim/tests/test_extension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def jp_server_config():
4545
"ServerApp": {
4646
"jpserver_extensions": {
4747
"notebook_shim": True,
48-
"notebook_shim.tests.shim.mockextension": True
48+
"notebook_shim.tests.mockextension": True
4949
}
5050
}
5151
}

0 commit comments

Comments
 (0)