Skip to content

Commit

Permalink
Fix for Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Dec 12, 2023
1 parent fb026ba commit 5e5749f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.11"]
python-version: ["3.8", "3.12"]
# PyPy is not supported because we use the file_id_manager. See:
# https://github.com/jupyter-server/jupyter_server_fileid/issues/44
#include:
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ filterwarnings = [
"module:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning",
# In PyPy/Cython: see https://github.com/yaml/pyyaml/issues/688
"ignore:can't resolve package from __spec__ or __package__, falling back on __name__ and __path__:ImportWarning",
# see https://github.com/dateutil/dateutil/issues/1314
"ignore:.*datetime.utcfromtimestamp\\(\\) is deprecated.*:DeprecationWarning:",
]

[tool.mypy]
Expand Down
18 changes: 18 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,30 @@
from jupyter_collaboration.loaders import FileLoader
from jupyter_collaboration.rooms import DocumentRoom
from jupyter_collaboration.stores import SQLiteYStore
from jupyter_server.serverapp import ServerApp

from .utils import FakeContentsManager, FakeEventLogger, FakeFileIDManager

pytest_plugins = ["jupyter_server.pytest_plugin", "jupyter_server_fileid.pytest_plugin"]


@pytest.fixture(autouse=True)
def jp_server_cleanup(jp_asyncio_loop): # noqa: PT004
"""Automatically cleans up server resources."""
yield
if jp_asyncio_loop.is_closed():
return

app: ServerApp = ServerApp.instance()
try:
jp_asyncio_loop.run_until_complete(app._cleanup())
except (RuntimeError, SystemExit) as e:
print("ignoring cleanup error", e) # noqa: T201
if hasattr(app, "kernel_manager"):
app.kernel_manager.context.destroy()
ServerApp.clear_instance()


@pytest.fixture
def jp_server_config(jp_root_dir, jp_server_config):
return {
Expand Down

0 comments on commit 5e5749f

Please sign in to comment.