Skip to content

Commit b7214a0

Browse files
authored
Merge pull request #84 from Carreau/314
Drop 3.8, Start testing on 3.13, 3.14 and 3.14t, update precommit
2 parents 79fb0d1 + 2e4eba4 commit b7214a0

File tree

11 files changed

+123
-78
lines changed

11 files changed

+123
-78
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
os: [ubuntu-latest, windows-latest, macos-latest]
20-
python-version: ["3.8", "3.12"]
20+
python-version: ["3.9", "3.13", "3.14", "3.14t"]
2121
include:
2222
- os: windows-latest
2323
python-version: "3.9"
2424
- os: ubuntu-latest
2525
python-version: "pypy-3.9"
26-
- os: ubuntu-latest
27-
python-version: "3.8"
2826
- os: macos-latest
2927
python-version: "3.10"
3028
steps:
@@ -33,10 +31,10 @@ jobs:
3331
- name: Run the tests on pypy
3432
if: ${{ startsWith(matrix.python-version, 'pypy') }}
3533
run: |
36-
hatch run test:nowarn || hatch run test:nowarn --lf
34+
hatch run test:nowarn
3735
- name: Run the tests
3836
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
39-
run: hatch run cov:test || hatch run test:test --lf
37+
run: hatch run cov:test
4038
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1
4139

4240
coverage:
@@ -82,7 +80,7 @@ jobs:
8280
dependency_type: minimum
8381
- name: Run the unit tests
8482
run: |
85-
hatch -v run test:nowarn || hatch run test:nowarn --lf
83+
hatch -v run test:nowarn
8684
8785
test_prereleases:
8886
name: Test Prereleases
@@ -95,7 +93,7 @@ jobs:
9593
dependency_type: pre
9694
- name: Run the tests
9795
run: |
98-
hatch run test:nowarn || hatch run test:nowarn --lf
96+
hatch run test:nowarn
9997
10098
make_sdist:
10199
name: Make SDist

.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.5.0
7+
rev: v6.0.0
88
hooks:
99
- id: check-case-conflict
1010
- id: check-ast
@@ -21,12 +21,12 @@ repos:
2121
- id: trailing-whitespace
2222

2323
- repo: https://github.com/python-jsonschema/check-jsonschema
24-
rev: 0.27.4
24+
rev: 0.34.1
2525
hooks:
2626
- id: check-github-workflows
2727

28-
- repo: https://github.com/executablebooks/mdformat
29-
rev: 0.7.17
28+
- repo: https://github.com/hukkin/mdformat
29+
rev: 0.7.22
3030
hooks:
3131
- id: mdformat
3232

@@ -37,19 +37,19 @@ repos:
3737
types_or: [yaml, html, json]
3838

3939
- repo: https://github.com/adamchainz/blacken-docs
40-
rev: "1.16.0"
40+
rev: "1.20.0"
4141
hooks:
4242
- id: blacken-docs
4343
additional_dependencies: [black==23.7.0]
4444

4545
- repo: https://github.com/codespell-project/codespell
46-
rev: "v2.2.6"
46+
rev: "v2.4.1"
4747
hooks:
4848
- id: codespell
4949
args: ["-L", "sur,nd"]
5050

5151
- repo: https://github.com/pre-commit/mirrors-mypy
52-
rev: "v1.8.0"
52+
rev: "v1.18.2"
5353
hooks:
5454
- id: mypy
5555
files: pytest_jupyter
@@ -71,16 +71,16 @@ repos:
7171
- id: rst-inline-touching-normal
7272

7373
- repo: https://github.com/astral-sh/ruff-pre-commit
74-
rev: v0.2.0
74+
rev: v0.14.0
7575
hooks:
76-
- id: ruff
76+
- id: ruff-check
7777
types_or: [python, jupyter]
7878
args: ["--fix", "--show-fixes"]
7979
- id: ruff-format
8080
types_or: [python, jupyter]
8181

8282
- repo: https://github.com/scientific-python/cookie
83-
rev: "2024.01.24"
83+
rev: "2025.10.01"
8484
hooks:
8585
- id: sp-repo-review
8686
additional_dependencies: ["repo-review[cli]"]

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@
109109

110110
- Add more ci checks by @blink1073 in https://github.com/jupyter-server/pytest-jupyter/pull/42
111111
- Bump ruff from 0.0.189 to 0.0.194 by @dependabot in https://github.com/jupyter-server/pytest-jupyter/pull/43
112-
- Bump black\[jupyter\] from 22.10.0 to 22.12.0 by @dependabot in https://github.com/jupyter-server/pytest-jupyter/pull/44
112+
- Bump black[jupyter] from 22.10.0 to 22.12.0 by @dependabot in https://github.com/jupyter-server/pytest-jupyter/pull/44
113113
- Clean up lint by @blink1073 in https://github.com/jupyter-server/pytest-jupyter/pull/45
114-
- \[pre-commit.ci\] pre-commit autoupdate by @pre-commit-ci in https://github.com/jupyter-server/pytest-jupyter/pull/46
114+
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/jupyter-server/pytest-jupyter/pull/46
115115
- Sync lint deps by @blink1073 in https://github.com/jupyter-server/pytest-jupyter/pull/47
116116
- Add more linting by @blink1073 in https://github.com/jupyter-server/pytest-jupyter/pull/48
117-
- \[pre-commit.ci\] pre-commit autoupdate by @pre-commit-ci in https://github.com/jupyter-server/pytest-jupyter/pull/49
118-
- \[pre-commit.ci\] pre-commit autoupdate by @pre-commit-ci in https://github.com/jupyter-server/pytest-jupyter/pull/50
117+
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/jupyter-server/pytest-jupyter/pull/49
118+
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/jupyter-server/pytest-jupyter/pull/50
119119
- Enable header overrides in jp_ws_fetch fixture by @kevin-bates in https://github.com/jupyter-server/pytest-jupyter/pull/51
120120

121121
([GitHub contributors page for this release](https://github.com/jupyter-server/pytest-jupyter/graphs/contributors?from=2022-12-19&to=2023-03-30&type=c))

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ that provides a factory function that starts a kernel using the `echo` kernel
4040
by default.
4141

4242
*Note*: The server plugin also includes the client plugin, so you can use both
43-
sets of fixtures with `"pytest_jupyter.jupyter_server"`. Both the `client`
43+
sets of fixtures with `"pytest_jupyter.jupyter_server"`. Both the `client`
4444
and `server` plugins also include the core fixtures.
4545

4646
*Note*: The client and server plugins use `pytest-tornasync` for async
47-
test suite running. It may not compatible with `pytest-asyncio`, meaning
48-
that all fixtures must be synchronous. You can use the `asyncio_loop` fixture
47+
test suite running. It may not compatible with `pytest-asyncio`, meaning
48+
that all fixtures must be synchronous. You can use the `asyncio_loop` fixture
4949
and run `asyncio_loop.run_until_complete` against an async function in your
5050
fixtures if needed.
5151

52-
The server fixures use the echo kernel by default. To override this behavior,
52+
The server fixures use the echo kernel by default. To override this behavior,
5353
override the `jp_server_config` fixture and add the following config:
5454

5555
```json

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies = [
3030
"pytest>=7.0",
3131
"jupyter_core>=5.7"
3232
]
33-
requires-python = ">=3.8"
33+
requires-python = ">=3.10"
3434

3535

3636
[project.optional-dependencies]
@@ -100,7 +100,7 @@ dependencies = ["pre-commit"]
100100
detached = true
101101
[tool.hatch.envs.lint.scripts]
102102
build = [
103-
"pre-commit run --all-files ruff",
103+
"pre-commit run --all-files ruff-check",
104104
"pre-commit run --all-files ruff-format"
105105
]
106106

@@ -125,6 +125,7 @@ filterwarnings= [
125125
# Fail on warnings
126126
"error",
127127
"module:datetime.datetime.utc:DeprecationWarning",
128+
"ignore:.*asyncio.DefaultEventLoopPolicy.*:DeprecationWarning"
128129
]
129130

130131
[tool.coverage.report]
@@ -147,7 +148,7 @@ source = ["pytest_jupyter"]
147148

148149
[tool.mypy]
149150
files = "pytest_jupyter"
150-
python_version = "3.8"
151+
python_version = "3.10"
151152
strict = true
152153
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
153154
disable_error_code = ["no-untyped-def"]

pytest_jupyter/echo_kernel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A simple echo kernel."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
from __future__ import annotations
@@ -61,7 +62,7 @@ def do_execute( # type:ignore[override]
6162
class EchoKernelApp(IPKernelApp):
6263
"""An app for the echo kernel."""
6364

64-
kernel_class = EchoKernel # type:ignore[assignment]
65+
kernel_class = EchoKernel
6566

6667

6768
if __name__ == "__main__":

pytest_jupyter/jupyter_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
from pytest_jupyter.jupyter_core import * # noqa: F403
2424

2525

26-
@pytest.fixture()
26+
@pytest.fixture
2727
def jp_zmq_context():
2828
"""Get a zmq context."""
29-
import zmq
29+
import zmq # noqa: PLC0415
3030

3131
ctx = zmq.asyncio.Context()
3232
yield ctx
3333
ctx.term()
3434

3535

36-
@pytest.fixture()
36+
@pytest.fixture
3737
def jp_start_kernel(jp_environ, jp_asyncio_loop):
3838
"""Get a function to a kernel and clean up resources when done."""
3939
kms = []

pytest_jupyter/jupyter_core.py

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
"""Fixtures for use with jupyter core and downstream."""
2+
23
# Copyright (c) Jupyter Development Team.
34
# Distributed under the terms of the Modified BSD License.
45
import json
56
import os
67
import sys
8+
import warnings
79
from inspect import iscoroutinefunction
810
from pathlib import Path
911

@@ -38,7 +40,13 @@
3840
@pytest.fixture(autouse=True)
3941
def jp_asyncio_loop():
4042
"""Get an asyncio loop."""
41-
loop = ensure_event_loop(prefer_selector_loop=True)
43+
with warnings.catch_warnings():
44+
warnings.filterwarnings(
45+
"ignore",
46+
message=".*WindowsSelectorEventLoopPolicy.*",
47+
category=DeprecationWarning,
48+
)
49+
loop = ensure_event_loop(prefer_selector_loop=True)
4250
yield loop
4351
loop.close()
4452

@@ -61,79 +69,91 @@ def pytest_pyfunc_call(pyfuncitem):
6169
pyfuncitem.obj(**testargs)
6270
return True
6371

64-
loop = ensure_event_loop(prefer_selector_loop=True)
72+
with warnings.catch_warnings():
73+
warnings.filterwarnings(
74+
"ignore",
75+
message=".*WindowsSelectorEventLoopPolicy.*",
76+
category=DeprecationWarning,
77+
)
78+
loop = ensure_event_loop(prefer_selector_loop=True)
6579
loop.run_until_complete(pyfuncitem.obj(**testargs))
6680
return True
6781

6882

69-
@pytest.fixture()
83+
@pytest.fixture
7084
def jp_home_dir(tmp_path):
7185
"""Provides a temporary HOME directory value."""
7286
return mkdir(tmp_path, "home")
7387

7488

75-
@pytest.fixture()
89+
@pytest.fixture
7690
def jp_data_dir(tmp_path):
7791
"""Provides a temporary Jupyter data dir directory value."""
7892
return mkdir(tmp_path, "data")
7993

8094

81-
@pytest.fixture()
95+
@pytest.fixture
8296
def jp_config_dir(tmp_path):
8397
"""Provides a temporary Jupyter config dir directory value."""
8498
return mkdir(tmp_path, "config")
8599

86100

87-
@pytest.fixture()
101+
@pytest.fixture
88102
def jp_runtime_dir(tmp_path):
89103
"""Provides a temporary Jupyter runtime dir directory value."""
90104
return mkdir(tmp_path, "runtime")
91105

92106

93-
@pytest.fixture()
107+
@pytest.fixture
94108
def jp_system_jupyter_path(tmp_path):
95109
"""Provides a temporary Jupyter system path value."""
96110
return mkdir(tmp_path, "share", "jupyter")
97111

98112

99-
@pytest.fixture()
113+
@pytest.fixture
100114
def jp_env_jupyter_path(tmp_path):
101115
"""Provides a temporary Jupyter env system path value."""
102116
return mkdir(tmp_path, "env", "share", "jupyter")
103117

104118

105-
@pytest.fixture()
119+
@pytest.fixture
106120
def jp_system_config_path(tmp_path):
107121
"""Provides a temporary Jupyter config path value."""
108122
return mkdir(tmp_path, "etc", "jupyter")
109123

110124

111-
@pytest.fixture()
125+
@pytest.fixture
112126
def jp_env_config_path(tmp_path):
113127
"""Provides a temporary Jupyter env config path value."""
114128
return mkdir(tmp_path, "env", "etc", "jupyter")
115129

116130

117-
@pytest.fixture()
131+
@pytest.fixture
118132
def jp_kernel_dir(jp_data_dir):
119133
"""Get the directory for kernel specs."""
120134
return mkdir(jp_data_dir, "kernels")
121135

122136

123-
@pytest.fixture()
137+
@pytest.fixture
124138
def echo_kernel_spec(jp_kernel_dir):
125139
"""Install a kernel spec for the echo kernel."""
126140
test_dir = Path(jp_kernel_dir) / "echo"
127141
test_dir.mkdir(parents=True, exist_ok=True)
128-
argv = [sys.executable, "-m", "pytest_jupyter.echo_kernel", "-f", "{connection_file}"]
142+
argv = [
143+
sys.executable,
144+
"-m",
145+
"pytest_jupyter.echo_kernel",
146+
"-f",
147+
"{connection_file}",
148+
]
129149
kernel_data = {"argv": argv, "display_name": "echo", "language": "echo"}
130150
spec_file_path = Path(test_dir / "kernel.json")
131151
spec_file_path.write_text(json.dumps(kernel_data), "utf8")
132152
return str(test_dir)
133153

134154

135-
@pytest.fixture()
136-
def jp_environ( # noqa: PT004
155+
@pytest.fixture
156+
def jp_environ(
137157
monkeypatch,
138158
tmp_path,
139159
jp_home_dir,

0 commit comments

Comments
 (0)