Skip to content

Commit 518c9c8

Browse files
authored
Merge pull request #345 from consideRatio/pr/add-test
Add test for Python 3.12, jupyter_server 1, notebook 5 and 7, and git 2.43 (ubuntu 24.04)
2 parents 253c012 + a55f65a commit 518c9c8

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ jobs:
2828
matrix:
2929
include:
3030
- python-version: "3.7"
31+
pip-install: "jupyter_server==1.* notebook==5.*"
3132
- python-version: "3.8"
33+
pip-install: "jupyter_server==1.* notebook==6.*"
3234
# 2.17 is in ubuntu 18.04
3335
git-version: "2.17"
3436
- python-version: "3.9"
@@ -38,6 +40,9 @@ jobs:
3840
# 2.34 is in ubuntu 22.04
3941
git-version: "2.34"
4042
- python-version: "3.11"
43+
- python-version: "3.12"
44+
# 2.43 is in ubuntu 24.04
45+
git-version: "2.43"
4146

4247
steps:
4348
- uses: actions/checkout@v4
@@ -47,14 +52,14 @@ jobs:
4752

4853
- uses: actions/setup-node@v4
4954
with:
50-
node-version: "${{ matrix.node-version || '18'}}"
55+
node-version: "lts/*"
5156

5257
- name: install git ${{ matrix.git-version }}
5358
if: ${{ matrix.git-version }}
5459
run: |
5560
export MAMBA_ROOT_PREFIX=$/tmp/conda
5661
mkdir -p $MAMBA_ROOT_PREFIX/bin
57-
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/1.4.2 | tar -xvj -C $MAMBA_ROOT_PREFIX/bin/ --strip-components=1 bin/micromamba
62+
curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/1.5.8 | tar -xvj -C $MAMBA_ROOT_PREFIX/bin/ --strip-components=1 bin/micromamba
5863
$MAMBA_ROOT_PREFIX/bin/micromamba install -c conda-forge -p $MAMBA_ROOT_PREFIX "git=${{ matrix.git-version }}"
5964
echo "PATH=$MAMBA_ROOT_PREFIX/bin:$PATH" >> $GITHUB_ENV
6065
@@ -70,10 +75,12 @@ jobs:
7075
7176
- name: Install dependencies
7277
run: |
73-
pip install -r dev-requirements.txt
74-
pip install .
78+
pip install -r dev-requirements.txt ${{ matrix.pip-install }} .
79+
80+
- name: List dependencies
81+
run: |
7582
pip freeze
7683
7784
- name: Run tests
7885
run: |
79-
pytest --verbose --maxfail=2 --color=yes --cov nbgitpuller tests
86+
pytest --maxfail=2

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
jupyter-packaging>=0.10
22
nbclassic
3-
notebook>=5.5,<7
3+
notebook>=5.5
44
packaging
55
pytest
66
pytest-cov

pyproject.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,23 @@ target_version = [
4040
"py39",
4141
"py310",
4242
"py311",
43+
"py312",
4344
]
4445

46+
47+
# pytest is used for running Python based tests
48+
#
49+
# ref: https://docs.pytest.org/en/stable/
50+
#
4551
[tool.pytest.ini_options]
52+
addopts = "--verbose --color=yes --durations=10 --cov nbgitpuller"
53+
asyncio_mode = "auto"
54+
testpaths = ["tests"]
4655
markers = [
4756
"jupyter_server: configure the jupyter_server fixture"
4857
]
4958

5059

51-
5260
# tbump is used to simplify and standardize the release process when updating
5361
# the version, making a git commit and tag, and pushing changes.
5462
#

tests/test_api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import time
55
from urllib.parse import urlencode
66
from uuid import uuid4
7+
import notebook
78
import pytest
89

910
from repohelpers import Pusher, Remote
@@ -65,21 +66,24 @@ def jupyter_server(request, tmpdir, jupyterdir):
6566
if extra_env:
6667
env.update(extra_env)
6768

69+
extension_command = ["jupyter", "server", "extension"]
6870
if backend_type == "jupyter-server":
6971
command = [
7072
'jupyter-server',
7173
'--ServerApp.token=secret',
7274
'--port={}'.format(PORT),
7375
]
74-
extension_command = ["jupyter", "server", "extension"]
7576
elif backend_type == "jupyter-notebook":
7677
command = [
7778
'jupyter-notebook',
7879
'--no-browser',
7980
'--NotebookApp.token=secret',
8081
'--port={}'.format(PORT),
8182
]
82-
extension_command = ["jupyter", "serverextension"]
83+
# notebook <7 require "jupyter serverextension" instead of "jupyter
84+
# server extension"
85+
if notebook.version_info[0] < 7:
86+
extension_command = ["jupyter", "serverextension"]
8387
else:
8488
raise ValueError(
8589
f"backend_type must be 'jupyter-server' or 'jupyter-notebook' not {backend_type!r}"

0 commit comments

Comments
 (0)