Skip to content

Commit 5dc42f4

Browse files
authored
Add support for Jupyter Server 2 (jupyterlab#1203)
* handler prepare is async in jp server 2 * Print listing output * Don't install jupyter-archive as it does not support JP server 2 * Migrate to pytest-jupyter * Skip hybridcontents tests That package does not support Jupyter Server 2 * Lint the code
1 parent 9aab9cc commit 5dc42f4

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ jobs:
7878
7979
# Integration test
8080
python -m pip install .
81+
jupyter server extension list
8182
jupyter server extension list 2>&1 | grep -ie "jupyterlab_git.*OK"
82-
83+
jupyter labextension list
8384
jupyter labextension list 2>&1 | grep -ie "@jupyterlab/git.*OK"
8485
python -m jupyterlab.browser_check
8586

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
pytest_plugins = ["jupyter_server.pytest_plugin"]
3+
pytest_plugins = ["pytest_jupyter.jupyter_server"]
44

55

66
@pytest.fixture

jupyterlab_git/handlers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import tornado
1111
from jupyter_server.base.handlers import APIHandler, path_regex
1212
from jupyter_server.services.contents.manager import ContentsManager
13-
from jupyter_server.utils import url2path, url_path_join
13+
from jupyter_server.utils import url2path, url_path_join, ensure_async
1414
from packaging.version import parse
1515
import fnmatch
1616

@@ -38,9 +38,9 @@ class GitHandler(APIHandler):
3838
def git(self) -> Git:
3939
return self.settings["git"]
4040

41-
def prepare(self):
41+
async def prepare(self):
4242
"""Check if the path should be skipped"""
43-
super().prepare()
43+
await ensure_async(super().prepare())
4444
path = self.path_kwargs.get("path")
4545
if path is not None:
4646
excluded_paths = self.git.excluded_paths

jupyterlab_git/tests/test_hybridcontents.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010

1111
pytest.importorskip("hybridcontents")
12+
# FIXME requires hybridcontents update to Jupyter Server 2
13+
pytestmark = pytest.mark.skipif(
14+
True, reason="hybridcontents is not compatible with Jupyter Server 2"
15+
)
1216

1317

1418
@pytest.fixture

setup.cfg

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ classifiers =
2222
[options]
2323
packages = find:
2424
install_requires =
25-
jupyter_server
25+
jupyter_server>=1.21.0,<3
2626
nbdime~=3.1
2727
nbformat
2828
packaging
@@ -42,10 +42,11 @@ dev=
4242
pytest
4343
pytest-asyncio
4444
pytest-cov
45-
pytest-tornasync
45+
pytest-jupyter[server]>=0.6
4646
tests=
4747
%(dev)s
4848
hybridcontents
49-
jupyter-archive
5049
jupytext
51-
50+
ui-tests=
51+
%(tests)s
52+
jupyter-archive

0 commit comments

Comments
 (0)