Skip to content

Commit

Permalink
TST: fail on warnings (#647)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bsipocz authored Dec 5, 2024
1 parent 6ee8d01 commit 2cd6874
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- os: ubuntu-latest
python-version: "3.11"
sphinx: "==7.0.0"
myst-parser: "==2.0.0"
myst-parser: "==3.0.0"
# Newest known-compatible dependencies
- os: ubuntu-latest
python-version: "3.12"
Expand Down
7 changes: 5 additions & 2 deletions myst_nb/core/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ def create_nb_reader(
:returns: the notebook reader, and the (potentially modified) MdParserConfig,
or None if the input cannot be read as a notebook.
"""
# the import is here so this module can be loaded without sphinx
from sphinx.util import import_object

try:
from sphinx.util._importer import import_object
except ImportError:
from sphinx.util import import_object

# get all possible readers
readers = nb_config.custom_formats.copy()
Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ show_error_codes = true
check_untyped_defs = true
strict_equality = true
no_implicit_optional = true
ignore_missing_imports = true
warn_unused_ignores = true

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

[tool.ruff.lint.isort]
force-sort-within-sections = true

[tool.pytest.ini_options]
filterwarnings = [
'error',
'ignore:unclosed database in:ResourceWarning',
# from asyncio triggered by jupyter_client
'ignore:There is no current event loop:DeprecationWarning',
'ignore:Parsing dates involving a day of month without a year specified is :DeprecationWarning',
# from jupyter_core
'ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning',
# nbclient
'ignore:Parsing dates involving a day of month without a year specified is :DeprecationWarning:nbclient',
# From dateutil in sqlalchemy and jupyter_cache
'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:sqlalchemy',
'ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:jupyter_cache',
# Windows issues, some may need to be fixed in MyST-NB, others are upstream
'ignore:Proactor event loop does not implement add_reader:RuntimeWarning:zmq',
]

markers = [
"sphinx_params",
]

0 comments on commit 2cd6874

Please sign in to comment.