From ed3f7f5af6c7681aece5343c59f77a3848fac5db Mon Sep 17 00:00:00 2001 From: TAKAHASHI Shuuji Date: Tue, 12 Sep 2023 12:53:26 +0900 Subject: [PATCH] test: fix deprecation warning about path by using suggested Pathlib When running the tests, I saw the following deprecation warning: ```shell > pipx run nox -s test nox > Running session test nox > Re-using existing virtual environment at .nox/test. nox > python -m pip install -e . nox > python -m pip install -r dev-requirements.txt nox > pytest =============================================================================== test session starts =============================================================================== platform darwin -- Python 3.11.5, pytest-7.1.3, pluggy-1.3.0 rootdir: /Users/shuuji3/dev/sphinxext-opengraph collected 37 items tests/test_options.py ..........s.......................... [100%] ================================================================================ warnings summary ================================================================================= tests/conftest.py:3 /Users/shuuji3/dev/sphinxext-opengraph/tests/conftest.py:3: RemovedInSphinx90Warning: 'sphinx.testing.path' is deprecated. Use 'os.path' or 'pathlib' instead. from sphinx.testing.path import path -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ==================================================================== 36 passed, 1 skipped, 1 warning in 1.67s ===================================================================== nox > Session test was successful. ``` --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 57ac73c..de94ce4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,6 @@ import pytest from bs4 import BeautifulSoup -from sphinx.testing.path import path +from pathlib import Path from sphinx.application import Sphinx @@ -10,7 +10,7 @@ @pytest.fixture(scope="session") def rootdir(): - return path(__file__).parent.abspath() / "roots" + return Path(__file__).parent.absolute() / "roots" @pytest.fixture()