-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* set draft of customlabextension * add get_page_config hook * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove url param * remove unused conf param * add path to conf page * use the hook to modify the default get_page function * make page_config_hook optional * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update voila/app.py Co-authored-by: Duc Trung Le <[email protected]> * add server extension hoooks * add page_config_hook documentation * document hook * Move hooks to VoilaConfiguration * Add test * Fix rebasing issue --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Duc Trung Le <[email protected]> Co-authored-by: martinRenou <[email protected]>
- Loading branch information
1 parent
f8dd6a5
commit 6f45057
Showing
9 changed files
with
248 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
|
||
BASE_DIR = os.path.dirname(__file__) | ||
|
||
|
||
@pytest.fixture | ||
def voila_notebook(notebook_directory): | ||
return os.path.join(notebook_directory, "print.ipynb") | ||
|
||
|
||
@pytest.fixture | ||
def voila_config(): | ||
def foo(current_page_config, **kwargs): | ||
current_page_config["foo"] = "my custom config" | ||
return current_page_config | ||
|
||
def config(app): | ||
app.voila_configuration.page_config_hook = foo | ||
|
||
return config | ||
|
||
|
||
async def test_prelaunch_hook(http_server_client, base_url): | ||
response = await http_server_client.fetch(base_url) | ||
assert response.code == 200 | ||
assert "my custom config" in response.body.decode("utf-8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.