Skip to content

Commit

Permalink
Add support for Jupyter Server 2 (#1203)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
fcollonval authored Dec 15, 2022
1 parent 9aab9cc commit 5dc42f4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ jobs:
# Integration test
python -m pip install .
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyterlab_git.*OK"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@jupyterlab/git.*OK"
python -m jupyterlab.browser_check
Expand Down
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

pytest_plugins = ["jupyter_server.pytest_plugin"]
pytest_plugins = ["pytest_jupyter.jupyter_server"]


@pytest.fixture
Expand Down
6 changes: 3 additions & 3 deletions jupyterlab_git/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import tornado
from jupyter_server.base.handlers import APIHandler, path_regex
from jupyter_server.services.contents.manager import ContentsManager
from jupyter_server.utils import url2path, url_path_join
from jupyter_server.utils import url2path, url_path_join, ensure_async
from packaging.version import parse
import fnmatch

Expand Down Expand Up @@ -38,9 +38,9 @@ class GitHandler(APIHandler):
def git(self) -> Git:
return self.settings["git"]

def prepare(self):
async def prepare(self):
"""Check if the path should be skipped"""
super().prepare()
await ensure_async(super().prepare())
path = self.path_kwargs.get("path")
if path is not None:
excluded_paths = self.git.excluded_paths
Expand Down
4 changes: 4 additions & 0 deletions jupyterlab_git/tests/test_hybridcontents.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@


pytest.importorskip("hybridcontents")
# FIXME requires hybridcontents update to Jupyter Server 2
pytestmark = pytest.mark.skipif(
True, reason="hybridcontents is not compatible with Jupyter Server 2"
)


@pytest.fixture
Expand Down
9 changes: 5 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers =
[options]
packages = find:
install_requires =
jupyter_server
jupyter_server>=1.21.0,<3
nbdime~=3.1
nbformat
packaging
Expand All @@ -42,10 +42,11 @@ dev=
pytest
pytest-asyncio
pytest-cov
pytest-tornasync
pytest-jupyter[server]>=0.6
tests=
%(dev)s
hybridcontents
jupyter-archive
jupytext

ui-tests=
%(tests)s
jupyter-archive

0 comments on commit 5dc42f4

Please sign in to comment.