From e2eb8f2a166ba7b339309b8bfbff40e6c9e0a9b9 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Wed, 23 Aug 2023 08:26:05 +0200 Subject: [PATCH] Require importlib_resources for testing on Python < 3.10 (#7016) * importlib_resources 5.0 is python < 3.10 * Add python matrix to test workflow * Ignore datetime.utcnow deprecation from Python 3.12 * lint: remove type ignore * More datetime.utc deprecation --- .github/workflows/build.yml | 5 +++++ pyproject.toml | 5 +++-- tests/conftest.py | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0663d839b3..c4504b7f4a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,11 @@ jobs: test: runs-on: ubuntu-latest timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + # used by the jupyterlab/maintainer-tools base-setup action + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout uses: actions/checkout@v3 diff --git a/pyproject.toml b/pyproject.toml index 2e366f0bd3..562754374f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,6 @@ classifiers = [ ] dependencies = [ "jupyter_server>=2.4.0,<3", - "importlib-resources>=5.0;python_version<\"3.9\"", "jupyterlab>=4.0.2,<5", "jupyterlab_server>=2.22.1,<3", "notebook_shim>=0.2,<0.3", @@ -59,6 +58,7 @@ test = [ "ipykernel", "jupyter_server[test]>=2.4.0,<3", "jupyterlab_server[test]>=2.22.1,<3", + "importlib-resources>=5.0;python_version<\"3.10\"", ] docs = [ "myst_parser", @@ -203,7 +203,8 @@ filterwarnings = [ "error", "ignore:There is no current event loop:DeprecationWarning", "ignore:make_current is deprecated; start the event loop first", - "ignore:clear_current is deprecated" + "ignore:clear_current is deprecated", + "ignore:datetime.utc.* is deprecated", ] [tool.coverage.report] diff --git a/tests/conftest.py b/tests/conftest.py index c10ad325e4..bd80e70bf4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,11 +4,12 @@ import os.path as osp import pathlib import shutil +import sys -try: +if sys.version_info < (3, 10): + from importlib_resources import files +else: from importlib.resources import files -except ImportError: - from importlib_resources import files # type:ignore import pytest