1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
From: Karolina Surma <33810531+befeleme@users.noreply.github.com>
Date: Sat, 13 Jan 2024 04:52:08 +0100
Subject: Enable testing with Sphinx 7.2 (#28)
Co-authored-by: Dmitry Shachnev <mitya57@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
(cherry picked from commit 80d1d3925c17c1860283323972680690f81d7b18)
---
tests/test_jquery_installed.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tests/test_jquery_installed.py b/tests/test_jquery_installed.py
index d0537d0..c0af1e1 100644
--- a/tests/test_jquery_installed.py
+++ b/tests/test_jquery_installed.py
@@ -4,11 +4,15 @@ from pathlib import Path
import pytest
import sphinx
-from sphinx.testing.path import path
from sphinx.testing.util import SphinxTestApp
from sphinxcontrib.jquery import _FILES, _ROOT_DIR # NoQA
+if sphinx.version_info[:2] >= (7, 2):
+ test_path = Path
+else:
+ from sphinx.testing.path import path as test_path
+
def run_blank_app(srcdir, **kwargs):
Path(srcdir, "conf.py").write_text("", encoding="ascii")
@@ -24,11 +28,13 @@ def run_blank_app(srcdir, **kwargs):
@pytest.fixture(scope="function")
-def blank_app(tmpdir, monkeypatch):
+def blank_app(tmp_path, monkeypatch):
def inner(**kwargs):
- return run_blank_app(path(tmpdir), **kwargs)
+ return run_blank_app(test_path(tmp_path), **kwargs)
- monkeypatch.setattr("sphinx.application.abspath", lambda x: x)
+ # Sphinx>=7.2 doesn't have abspath
+ if sphinx.version_info[:2] < (7, 2):
+ monkeypatch.setattr("sphinx.application.abspath", lambda x: x)
yield inner
|