Skip to content

Commit

Permalink
Update conftest to use pathlib instead of older Sphinx ``sphi…
Browse files Browse the repository at this point in the history
…nx.testing.path`` module that is being deprecated for forward-compatibility with newer Sphinx versions.
  • Loading branch information
devmonkey22 committed Sep 25, 2023
1 parent 57e0622 commit dab7018
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
7 changes: 7 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ Bugfix
`PEP 420 <https://peps.python.org/pep-0420/>`__ without ``__init_.py`` to match with
other extensions.

Testing
~~~~~~~

- Update ``conftest`` to use ``pathlib`` instead of older Sphinx ``sphinx.testing.path`` module
that is being deprecated for forward-compatibility with newer Sphinx versions.


v2.0.1 - 2023-08-01
-------------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "autodoc_pydantic"
version = "2.0.1"
version = "2.0.2"
description = "Seamlessly integrate pydantic models in your Sphinx documentation."
authors = ["mansenfranzen <franz.woellert@gmail.com>"]
packages = [{ include = "sphinxcontrib" }]
Expand Down
13 changes: 7 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import logging
from logging.handlers import MemoryHandler
from pathlib import Path
import shutil
from typing import Optional, Dict, List, Callable, Union, Any
from unittest.mock import Mock

Expand All @@ -15,7 +16,7 @@
from sphinx import application
from sphinx.application import Sphinx
from sphinx.cmd import build
from sphinx.testing.path import path

from sphinx.testing.restructuredtext import parse
from sphinx.util.docutils import LoggingReporter
from sphinx.ext.autodoc.directive import (
Expand Down Expand Up @@ -66,12 +67,12 @@


@pytest.fixture(scope='session')
def rootdir():
return path(__file__).parent.abspath() / 'roots'
def rootdir() -> Path:
return Path(__file__).parent.resolve() / 'roots'


@pytest.fixture(scope='session')
def docdir():
def docdir() -> Path:
"""Provides path to actual sphinx documentation of autodoc_pydantic.
"""
Expand Down Expand Up @@ -143,11 +144,11 @@ def create(testroot: str,
conf: Optional[Dict] = None,
deactivate_all: bool = False):
srcdir = sphinx_test_tempdir / testroot
srcdir.rmtree(ignore_errors=True)
shutil.rmtree(srcdir, ignore_errors=True)

if rootdir and not srcdir.exists():
testroot_path = rootdir / ('test-' + testroot)
testroot_path.copytree(srcdir)
shutil.copytree(testroot_path, srcdir)

kwargs = dict(srcdir=srcdir, confoverrides={})

Expand Down

0 comments on commit dab7018

Please sign in to comment.