python-sphinx/85ffb3b0.patch
2023-08-14 10:49:35 +02:00

101 lines
4.1 KiB
Diff

From 85ffb3b0fdcfefd5484e3fa895a46e3d11d7284f Mon Sep 17 00:00:00 2001
From: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Date: Mon, 7 Aug 2023 21:51:05 +0100
Subject: [PATCH] Fix ``test_assets_order`` for Pygments 2.16
---
tests/roots/test-html_file_checksum/conf.py | 1 +
tests/roots/test-html_file_checksum/index.rst | 0
tests/roots/test-html_file_checksum/static/empty.js | 0
.../roots/test-html_file_checksum/static/script.js | 1 +
.../test-html_file_checksum/static/stylesheet-a.css | 1 +
.../test-html_file_checksum/static/stylesheet-b.css | 1 +
tests/test_build_html.py | 13 ++++++++-----
7 files changed, 12 insertions(+), 5 deletions(-)
create mode 100644 tests/roots/test-html_file_checksum/conf.py
create mode 100644 tests/roots/test-html_file_checksum/index.rst
create mode 100644 tests/roots/test-html_file_checksum/static/empty.js
create mode 100644 tests/roots/test-html_file_checksum/static/script.js
create mode 100644 tests/roots/test-html_file_checksum/static/stylesheet-a.css
create mode 100644 tests/roots/test-html_file_checksum/static/stylesheet-b.css
diff --git a/tests/roots/test-html_file_checksum/conf.py b/tests/roots/test-html_file_checksum/conf.py
new file mode 100644
index 00000000000..f9188142153
--- /dev/null
+++ b/tests/roots/test-html_file_checksum/conf.py
@@ -0,0 +1 @@
+html_static_path = ['static']
diff --git a/tests/roots/test-html_file_checksum/index.rst b/tests/roots/test-html_file_checksum/index.rst
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/roots/test-html_file_checksum/static/empty.js b/tests/roots/test-html_file_checksum/static/empty.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/roots/test-html_file_checksum/static/script.js b/tests/roots/test-html_file_checksum/static/script.js
new file mode 100644
index 00000000000..9a21456003e
--- /dev/null
+++ b/tests/roots/test-html_file_checksum/static/script.js
@@ -0,0 +1 @@
+/* Script */
diff --git a/tests/roots/test-html_file_checksum/static/stylesheet-a.css b/tests/roots/test-html_file_checksum/static/stylesheet-a.css
new file mode 100644
index 00000000000..3a5d802510d
--- /dev/null
+++ b/tests/roots/test-html_file_checksum/static/stylesheet-a.css
@@ -0,0 +1 @@
+/* Stylesheet A */
diff --git a/tests/roots/test-html_file_checksum/static/stylesheet-b.css b/tests/roots/test-html_file_checksum/static/stylesheet-b.css
new file mode 100644
index 00000000000..ad5ff28f692
--- /dev/null
+++ b/tests/roots/test-html_file_checksum/static/stylesheet-b.css
@@ -0,0 +1 @@
+/* Stylesheet B */
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index 9a6326c69f5..5a10c964ae0 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -10,6 +10,7 @@
import pytest
from html5lib import HTMLParser
+import sphinx.builders.html
from sphinx.builders.html import validate_html_extra_path, validate_html_static_path
from sphinx.errors import ConfigError
from sphinx.testing.util import strip_escseq
@@ -1172,7 +1173,9 @@ def test_html_assets(app):
@pytest.mark.sphinx('html', testroot='html_assets')
-def test_assets_order(app):
+def test_assets_order(app, monkeypatch):
+ monkeypatch.setattr(sphinx.builders.html, '_file_checksum', lambda o, f: '')
+
app.add_css_file('normal.css')
app.add_css_file('early.css', priority=100)
app.add_css_file('late.css', priority=750)
@@ -1188,8 +1191,8 @@ def test_assets_order(app):
# css_files
expected = [
'_static/early.css',
- '_static/pygments.css?v=b3523f8e',
- '_static/alabaster.css?v=039e1c02',
+ '_static/pygments.css',
+ '_static/alabaster.css',
'https://example.com/custom.css',
'_static/normal.css',
'_static/late.css',
@@ -1202,8 +1205,8 @@ def test_assets_order(app):
# js_files
expected = [
'_static/early.js',
- '_static/doctools.js?v=888ff710',
- '_static/sphinx_highlight.js?v=4825356b',
+ '_static/doctools.js',
+ '_static/sphinx_highlight.js',
'https://example.com/script.js',
'_static/normal.js',
'_static/late.js',