Fix tests failures with Sphinx 7.2+

This commit is contained in:
Karolina Surma 2023-10-30 10:54:49 +01:00
parent 2806f6d2b9
commit cdee1a3e5b
2 changed files with 40 additions and 32 deletions

View File

@ -1,38 +1,39 @@
From ac97ce5202b05ddb6bf4e5b77151a8964b6bf632 Mon Sep 17 00:00:00 2001
From: Dmitry Shachnev <mitya57@gmail.com>
Date: Mon, 31 Jul 2023 15:22:24 +0300
Subject: [PATCH] Make the tests pass with Sphinx 7.1
From 8dea4055ab11c666635a0a03516767c1dcab9a50 Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Tue, 31 Oct 2023 11:01:26 +0100
Subject: [PATCH] Fix tests failures with Sphinx 7.2+
Based on original patch fixing test failures with Sphinx 7.1+ by mitya57:
https://github.com/sphinx-contrib/jquery/pull/26
Fixes #25.
---
.github/workflows/test.yml | 5 ++++-
tests/test_jquery_installed.py | 12 ++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
tests/test_jquery_installed.py | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 825010a..2c13fce 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -30,10 +30,13 @@ jobs:
- "4" # jQuery included
- "5" # jQuery deprecated
- "6" # jQuery removed
+ - "7"
exclude:
- # Sphinx 6 does not support Python 3.7
+ # Sphinx >= 6 does not support Python 3.7
- python: "3.7"
sphinx: "6"
+ - python: "3.7"
+ sphinx: "7"
steps:
- uses: actions/checkout@v3
diff --git a/tests/test_jquery_installed.py b/tests/test_jquery_installed.py
index a402bd4..08c25ba 100644
index a402bd4..f9fb85b 100644
--- a/tests/test_jquery_installed.py
+++ b/tests/test_jquery_installed.py
@@ -38,12 +38,14 @@ def test_jquery_installed_sphinx_ge_60_use_sri(blank_app):
@@ -4,7 +4,6 @@ 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
@@ -26,9 +25,8 @@ def run_blank_app(srcdir, **kwargs):
@pytest.fixture(scope="function")
def blank_app(tmpdir, monkeypatch):
def inner(**kwargs):
- return run_blank_app(path(tmpdir), **kwargs)
+ return run_blank_app(Path(tmpdir), **kwargs)
- monkeypatch.setattr("sphinx.application.abspath", lambda x: x)
yield inner
@@ -38,12 +36,14 @@ def test_jquery_installed_sphinx_ge_60_use_sri(blank_app):
out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"], "jquery_use_sri": True})
text = out_dir.joinpath("index.html").read_text(encoding="utf-8")
@ -49,7 +50,7 @@ index a402bd4..08c25ba 100644
static_dir = out_dir / '_static'
assert static_dir.joinpath('jquery.js').is_file()
@@ -56,10 +58,12 @@ def test_jquery_installed_sphinx_ge_60(blank_app):
@@ -56,10 +56,12 @@ def test_jquery_installed_sphinx_ge_60(blank_app):
out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"]})
text = out_dir.joinpath("index.html").read_text(encoding="utf-8")
@ -64,3 +65,6 @@ index a402bd4..08c25ba 100644
static_dir = out_dir / '_static'
assert static_dir.joinpath('jquery.js').is_file()
--
2.41.0

View File

@ -1,6 +1,6 @@
Name: python-sphinxcontrib-jquery
Version: 4.1
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Extension to include jQuery on newer Sphinx releases
# The project is 0BSD
@ -11,7 +11,8 @@ URL: https://github.com/sphinx-contrib/jquery/
Source: %{url}/archive/v%{version}/sphinxcontrib-jquery-%{version}.tar.gz
# Make the tests pass with Sphinx 7.1+
Patch: https://github.com/sphinx-contrib/jquery/pull/26.patch
# Based on the original work in https://github.com/sphinx-contrib/jquery/pull/26
Patch: Fix-tests-failures-with-Sphinx-7.2.patch
BuildArch: noarch
BuildRequires: python3-devel
@ -57,6 +58,9 @@ Summary: %{summary}
%changelog
* Mon Oct 30 2023 Karolina Surma <ksurma@redhat.com> - 4.1-5
- Fix tests with Sphinx 7.2+
* Tue Aug 15 2023 Karolina Surma <ksurma@redhat.com> - 4.1-4
- Fix tests with Sphinx 7.1+