Esempio n. 1
0
def test_extension_manager_fail_link(jp_serverapp):
    name = "jupyter_server.tests.extension.mockextensions.app"
    with mock.patch(
            "jupyter_server.tests.extension.mockextensions.app.MockExtensionApp.parse_command_line",
            side_effect=RuntimeError,
    ):
        manager = ExtensionManager(serverapp=jp_serverapp)
        manager.add_extension(name, enabled=True)
        manager.link_extension(name)  # should only warn
        jp_serverapp.reraise_server_extension_failures = True
        with pytest.raises(RuntimeError):
            manager.link_extension(name)
def test_extension_manager_fail_load(jp_serverapp):
    name = "tests.extension.mockextensions.app"
    with mock.patch(
            "tests.extension.mockextensions.app.MockExtensionApp.initialize_handlers",
            side_effect=RuntimeError,
    ):
        manager = ExtensionManager(serverapp=jp_serverapp)
        manager.add_extension(name, enabled=True)
        manager.link_extension(name)
        manager.load_extension(name)  # should only warn
        jp_serverapp.reraise_server_extension_failures = True
        with pytest.raises(RuntimeError):
            manager.load_extension(name)
def test_extension_manager_linked_extensions(jp_serverapp):
    name = "jupyter_server.tests.extension.mockextensions"
    manager = ExtensionManager()
    manager.add_extension(name, enabled=True)
    manager.link_extension(name, jp_serverapp)
    assert name in manager.linked_extensions