Skip to content

Commit

Permalink
update tests to changes in metadata function
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsailer committed Jul 27, 2020
1 parent 2c6572a commit 0deba0a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions jupyter_server/extension/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def get_loader(obj, logger=None):
func = getattr(obj, '_load_jupyter_server_extension')
except AttributeError:
func = getattr(obj, 'load_jupyter_server_extension')

except Exception:
raise ExtensionLoadingError("_load_jupyter_server_extension function was not found.")
return func
Expand All @@ -54,15 +53,15 @@ def get_metadata(package_name, logger=None):
module = importlib.import_module(package_name)

try:
return module._jupyter_server_extension_points
return module._jupyter_server_extension_points()
except AttributeError:
pass

# For backwards compatibility, we temporarily allow
# _jupyter_server_extension_paths. We will remove in
# a later release of Jupyter Server.
try:
return module._jupyter_server_extension_paths
return module._jupyter_server_extension_paths()
except AttributeError:
if logger:
logger.debug(
Expand Down
2 changes: 1 addition & 1 deletion tests/extension/mockextensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Function that makes these extensions discoverable
# by the test functions.
def _jupyter_server_extension_paths():
def _jupyter_server_extension_points():
return [
{
'module': 'tests.extension.mockextensions.app',
Expand Down
8 changes: 4 additions & 4 deletions tests/extension/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

def test_extension_point_api():
# Import mock extension metadata
from .mockextensions import _jupyter_server_extension_paths
from .mockextensions import _jupyter_server_extension_points

# Testing the first path (which is an extension app).
metadata_list = _jupyter_server_extension_paths()
metadata_list = _jupyter_server_extension_points()
point = metadata_list[0]

module = point["module"]
Expand Down Expand Up @@ -47,10 +47,10 @@ def test_extension_point_notfound_error():

def test_extension_package_api():
# Import mock extension metadata
from .mockextensions import _jupyter_server_extension_paths
from .mockextensions import _jupyter_server_extension_points

# Testing the first path (which is an extension app).
metadata_list = _jupyter_server_extension_paths()
metadata_list = _jupyter_server_extension_points()
path1 = metadata_list[0]
app = path1["app"]

Expand Down

0 comments on commit 0deba0a

Please sign in to comment.