From d273e74127a182c8b6213f7966fd8291caeaece6 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 11 Nov 2022 04:45:23 -0600 Subject: [PATCH] Test notebook prerelease (#1064) * test notebook prerelease * fix test * fix handling of merge config test * more cleanup --- .github/workflows/downstream.yml | 17 +++++++++++++++++ tests/extension/test_serverextension.py | 14 +++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml index b1afa65493..966c38b43c 100644 --- a/.github/workflows/downstream.yml +++ b/.github/workflows/downstream.yml @@ -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 diff --git a/tests/extension/test_serverextension.py b/tests/extension/test_serverextension.py index eb8390ed3c..0953504c07 100644 --- a/tests/extension/test_serverextension.py +++ b/tests/extension/test_serverextension.py @@ -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 @@ -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. @@ -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, ) @@ -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(