Skip to content

Commit

Permalink
chore: Catch DeprecationWarning of sphinx in running pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Jul 31, 2022
1 parent 0440aee commit 4891c6f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/conftest.py
@@ -1,12 +1,26 @@
"""Configuration for pytest."""
import inspect

import pytest
from _pytest.config import Config
from sphinx import deprecation
from sphinx.testing.path import path

pytest_plugins = "sphinx.testing.fixtures"

collect_ignore = ["roots"]


def pytest_configure(config: Config): # noqa
for name, klass in inspect.getmembers(deprecation, inspect.isclass):
if not issubclass(klass, DeprecationWarning) and not issubclass(
klass, PendingDeprecationWarning
):
continue
config.addinivalue_line(
"filterwarnings", f"error::{klass.__module__}.{klass.__name__}"
)


@pytest.fixture(scope="session")
def rootdir():
"""Set root directory to use testing sphinx project."""
Expand Down

0 comments on commit 4891c6f

Please sign in to comment.