def test_extension_point_api(): # Import mock extension metadata from .mockextensions import _jupyter_server_extension_points # Testing the first path (which is an extension app). metadata_list = _jupyter_server_extension_points() point = metadata_list[0] module = point["module"] app = point["app"] e = ExtensionPoint(metadata=point) assert e.module_name == module assert e.name == app.name assert app is not None assert callable(e.load) assert callable(e.link) assert e.validate()
def test_extension_point_notfound_error(): bad_metadata = {"module": "nonexistent"} with pytest.raises(ExtensionModuleNotFound): ExtensionPoint(metadata=bad_metadata)
def test_extension_point_metadata_error(): # Missing the "module" key. bad_metadata = {"name": "nonexistent"} with pytest.raises(ExtensionMetadataError): ExtensionPoint(metadata=bad_metadata)