Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for unable to lock any extension #16213

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

itsmevichu
Copy link
Contributor

Fix for #16203

This issue arises because the page_config lacks context regarding the locked plugins.

Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@krassowski krassowski added the bug label Apr 20, 2024
@krassowski krassowski added this to the 4.1.x milestone Apr 21, 2024
@krassowski
Copy link
Member

Looks good, but I think we need to add a test here. In particular something directly hitting the get() endpoint of PluginHandler API:

It would look similar to:

@pytest.fixture
def jp_server_config(jp_server_config, tmp_path):
config = jp_server_config.copy()
config["LabApp"]["custom_css"] = True
return config
async def test_CustomCssHandler(tmp_path, jp_serverapp, labserverapp, jp_fetch):
custom_path = tmp_path / "config" / "custom"
# Check we are placing the custom.css file in the appropriate folder
assert str(custom_path) in jp_serverapp.web_app.settings["static_custom_path"]
custom_path.mkdir(parents=True, exist_ok=True)
(custom_path / "custom.css").write_text(CUSTOM_CSS)
response = await jp_fetch("custom", "custom.css", method="GET")
assert response.code == 200
assert response.body.decode().replace(os.linesep, "\n") == CUSTOM_CSS

but using lock_extension and unlock_extension to setup the state, similarly to how disable/enable are used in:

def test_disable_extension(self):
options = AppOptions(app_dir=self.tempdir())
assert install_extension(self.mock_extension, app_options=options) is True
assert disable_extension(self.pkg_names["extension"], app_options=options) is True
info = get_app_info(app_options=options)
name = self.pkg_names["extension"]
assert info["disabled"].get(name) is True
assert not check_extension(name, app_options=options)
assert check_extension(name, installed=True, app_options=options)
assert disable_extension("@jupyterlab/notebook-extension", app_options=options) is True
info = get_app_info(app_options=options)
assert info["disabled"].get("@jupyterlab/notebook-extension") is True
assert not check_extension("@jupyterlab/notebook-extension", app_options=options)
assert check_extension(
"@jupyterlab/notebook-extension", installed=True, app_options=options
)
assert info["disabled"].get(name) is True
assert not check_extension(name, app_options=options)
assert check_extension(name, installed=True, app_options=options)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants