From 3b0986042f922b3dfbb872c577265c46f1cfe5d1 Mon Sep 17 00:00:00 2001 From: Zsailer Date: Mon, 27 Jul 2020 12:21:58 -0700 Subject: [PATCH] update tests to changes in metadata function --- jupyter_server/extension/utils.py | 5 ++--- tests/extension/mockextensions/__init__.py | 2 +- tests/extension/test_manager.py | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/jupyter_server/extension/utils.py b/jupyter_server/extension/utils.py index 84fa373f63..6c59ed1cbc 100644 --- a/jupyter_server/extension/utils.py +++ b/jupyter_server/extension/utils.py @@ -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 @@ -54,7 +53,7 @@ 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 @@ -62,7 +61,7 @@ def get_metadata(package_name, logger=None): # _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( diff --git a/tests/extension/mockextensions/__init__.py b/tests/extension/mockextensions/__init__.py index 702dc3b123..5e41c308d8 100644 --- a/tests/extension/mockextensions/__init__.py +++ b/tests/extension/mockextensions/__init__.py @@ -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', diff --git a/tests/extension/test_manager.py b/tests/extension/test_manager.py index 8ad38166f3..68d6d6200f 100644 --- a/tests/extension/test_manager.py +++ b/tests/extension/test_manager.py @@ -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"] @@ -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"]