Skip to content

Commit 2cd6874

Browse files
authored
TST: fail on warnings (#647)
* CONF: adding pytest config to fail on deprecationwarnings * DEP: remove deprecated sphinx usage * DEP: workaround deprecation * CONF: adding more deprecation warnings to ignore that are triggered upstream * CI: bump myst-parser dependency to avoid the deprecationwarning that gets triggered with the used version combo * Remove typoed upstream word to make codespell happy * CI: ignore warnings triggered only on windows
1 parent 6ee8d01 commit 2cd6874

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- os: ubuntu-latest
4242
python-version: "3.11"
4343
sphinx: "==7.0.0"
44-
myst-parser: "==2.0.0"
44+
myst-parser: "==3.0.0"
4545
# Newest known-compatible dependencies
4646
- os: ubuntu-latest
4747
python-version: "3.12"

myst_nb/core/read.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ def create_nb_reader(
5757
:returns: the notebook reader, and the (potentially modified) MdParserConfig,
5858
or None if the input cannot be read as a notebook.
5959
"""
60-
# the import is here so this module can be loaded without sphinx
61-
from sphinx.util import import_object
60+
61+
try:
62+
from sphinx.util._importer import import_object
63+
except ImportError:
64+
from sphinx.util import import_object
6265

6366
# get all possible readers
6467
readers = nb_config.custom_formats.copy()

pyproject.toml

+23
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ show_error_codes = true
131131
check_untyped_defs = true
132132
strict_equality = true
133133
no_implicit_optional = true
134+
ignore_missing_imports = true
134135
warn_unused_ignores = true
135136

136137
[[tool.mypy.overrides]]
@@ -149,3 +150,25 @@ ignore = [
149150

150151
[tool.ruff.lint.isort]
151152
force-sort-within-sections = true
153+
154+
[tool.pytest.ini_options]
155+
filterwarnings = [
156+
'error',
157+
'ignore:unclosed database in:ResourceWarning',
158+
# from asyncio triggered by jupyter_client
159+
'ignore:There is no current event loop:DeprecationWarning',
160+
'ignore:Parsing dates involving a day of month without a year specified is :DeprecationWarning',
161+
# from jupyter_core
162+
'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning',
163+
# nbclient
164+
'ignore:Parsing dates involving a day of month without a year specified is :DeprecationWarning:nbclient',
165+
# From dateutil in sqlalchemy and jupyter_cache
166+
'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:sqlalchemy',
167+
'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:jupyter_cache',
168+
# Windows issues, some may need to be fixed in MyST-NB, others are upstream
169+
'ignore:Proactor event loop does not implement add_reader:RuntimeWarning:zmq',
170+
]
171+
172+
markers = [
173+
"sphinx_params",
174+
]

0 commit comments

Comments
 (0)