Skip to content

Commit

Permalink
Test notebook prerelease (jupyter-server#1064)
Browse files Browse the repository at this point in the history
* test notebook prerelease

* fix test

* fix handling of merge config test

* more cleanup
  • Loading branch information
blink1073 authored Nov 11, 2022
1 parent 4b54816 commit d273e74
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ jobs:
kill $TASK_PID
wait $TASK_PID
notebook:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Test notebook
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
with:
package_name: notebook
package_download_extra_args: "--pre"

jupyterlab_server:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
14 changes: 11 additions & 3 deletions tests/extension/test_serverextension.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from collections import OrderedDict

import pytest

try:
from jupyter_core.paths import prefer_environment_over_user
except ImportError:
prefer_environment_over_user = None

from traitlets.tests.utils import check_help_all_output

from jupyter_server.config_manager import BaseJSONConfigManager
Expand Down Expand Up @@ -43,6 +49,7 @@ def test_disable(jp_env_config_path, jp_extension_environ):
assert not config["mock1"]


@pytest.mark.skipif(prefer_environment_over_user is None, reason="Requires jupyter_core 5.0+")
def test_merge_config(jp_env_config_path, jp_configurable_serverapp, jp_extension_environ):
# Toggle each extension module with a JSON config file
# at the sys-prefix config dir.
Expand All @@ -62,12 +69,12 @@ def test_merge_config(jp_env_config_path, jp_configurable_serverapp, jp_extensio
# when these two configs merge.
toggle_server_extension_python(
"tests.extension.mockextensions.mockext_both",
enabled=True,
enabled=False,
sys_prefix=True,
)
toggle_server_extension_python(
"tests.extension.mockextensions.mockext_both",
enabled=False,
enabled=True,
user=True,
)

Expand All @@ -82,7 +89,8 @@ def test_merge_config(jp_env_config_path, jp_configurable_serverapp, jp_extensio
assert extensions["tests.extension.mockextensions.mockext_sys"]
assert extensions["tests.extension.mockextensions.mockext_py"]
# Merging should causes this extension to be disabled.
assert not extensions["tests.extension.mockextensions.mockext_both"]
if prefer_environment_over_user():
assert not extensions["tests.extension.mockextensions.mockext_both"]


@pytest.mark.parametrize(
Expand Down

0 comments on commit d273e74

Please sign in to comment.