Skip to content

Commit

Permalink
Require importlib_resources for testing on Python < 3.10 (#7016)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bnavigator authored Aug 23, 2023
1 parent 76db867 commit e2eb8f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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]
Expand Down
7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e2eb8f2

Please sign in to comment.