Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for Python 3.12, jupyter_server 1, notebook 5 and 7, and git 2.43 (ubuntu 24.04) #345

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ jobs:
matrix:
include:
- python-version: "3.7"
pip-install: "jupyter_server==1.* notebook==5.*"
- python-version: "3.8"
pip-install: "jupyter_server==1.* notebook==6.*"
# 2.17 is in ubuntu 18.04
git-version: "2.17"
- python-version: "3.9"
Expand All @@ -38,6 +40,9 @@ jobs:
# 2.34 is in ubuntu 22.04
git-version: "2.34"
- python-version: "3.11"
- python-version: "3.12"
# 2.43 is in ubuntu 24.04
git-version: "2.43"

steps:
- uses: actions/checkout@v4
Expand All @@ -47,14 +52,14 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node-version || '18'}}"
node-version: "lts/*"

- name: install git ${{ matrix.git-version }}
if: ${{ matrix.git-version }}
run: |
export MAMBA_ROOT_PREFIX=$/tmp/conda
mkdir -p $MAMBA_ROOT_PREFIX/bin
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
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
$MAMBA_ROOT_PREFIX/bin/micromamba install -c conda-forge -p $MAMBA_ROOT_PREFIX "git=${{ matrix.git-version }}"
echo "PATH=$MAMBA_ROOT_PREFIX/bin:$PATH" >> $GITHUB_ENV

Expand All @@ -70,10 +75,12 @@ jobs:

- name: Install dependencies
run: |
pip install -r dev-requirements.txt
pip install .
pip install -r dev-requirements.txt ${{ matrix.pip-install }} .

- name: List dependencies
run: |
pip freeze

- name: Run tests
run: |
pytest --verbose --maxfail=2 --color=yes --cov nbgitpuller tests
pytest --maxfail=2
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
jupyter-packaging>=0.10
nbclassic
notebook>=5.5,<7
notebook>=5.5
packaging
pytest
pytest-cov
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,23 @@ target_version = [
"py39",
"py310",
"py311",
"py312",
]


# pytest is used for running Python based tests
#
# ref: https://docs.pytest.org/en/stable/
#
[tool.pytest.ini_options]
addopts = "--verbose --color=yes --durations=10 --cov nbgitpuller"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice, as then everyone can just run pytest locally.

asyncio_mode = "auto"
testpaths = ["tests"]
markers = [
"jupyter_server: configure the jupyter_server fixture"
]



# tbump is used to simplify and standardize the release process when updating
# the version, making a git commit and tag, and pushing changes.
#
Expand Down
8 changes: 6 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
from urllib.parse import urlencode
from uuid import uuid4
import notebook
import pytest

from repohelpers import Pusher, Remote
Expand Down Expand Up @@ -65,21 +66,24 @@ def jupyter_server(request, tmpdir, jupyterdir):
if extra_env:
env.update(extra_env)

extension_command = ["jupyter", "server", "extension"]
if backend_type == "jupyter-server":
command = [
'jupyter-server',
'--ServerApp.token=secret',
'--port={}'.format(PORT),
]
extension_command = ["jupyter", "server", "extension"]
elif backend_type == "jupyter-notebook":
command = [
'jupyter-notebook',
'--no-browser',
'--NotebookApp.token=secret',
'--port={}'.format(PORT),
]
extension_command = ["jupyter", "serverextension"]
# notebook <7 require "jupyter serverextension" instead of "jupyter
# server extension"
if notebook.version_info[0] < 7:
extension_command = ["jupyter", "serverextension"]
else:
raise ValueError(
f"backend_type must be 'jupyter-server' or 'jupyter-notebook' not {backend_type!r}"
Expand Down