From fa18b98e6a4a59ddcb62882fba9b41bf6eecfe3c Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 24 Aug 2026 13:11:44 +1000 Subject: [PATCH] FIX: Use alabaster in the gated test root to unbreak CI The `gateddirective` test root was the only HTML test root using a third-party theme (`html_theme = "sphinx_book_theme"`), which pulls in pydata-sphinx-theme. Current pydata-sphinx-theme calls `_get_toctree_ancestors`, which does not exist in Sphinx 6 or 7, so every HTML test using that root fails with: sphinx.errors.ThemeError: An error happened in rendering the page exercise. Reason: ImportError("cannot import name '_get_toctree_ancestors' from 'sphinx.environment.adapters.toctree'") This is dependency drift rather than a code regression: main last ran CI on 2025-11-17, before the theme released the change, and nothing in this repo changed. Six tests fail on the Sphinx 6 and 7 jobs. The theme is incidental to what these tests check. The regression fixtures capture only the `div.exercise` / `div.solution` markup this extension generates, so no third-party theme is needed to exercise them, and depending on one couples the suite to that theme's Sphinx support matrix. The other three HTML test roots already use alabaster; this brings the fourth into line. Pinning the theme instead was considered and rejected: it would need a per-Sphinx-version pin and would rot again on the next release, whereas removing the dependency from the HTML test path ends the whole class of failure. `test-simplebook` still names sphinx_book_theme but is only ever built with the latex builder, which never loads an HTML theme, so it is unaffected and left alone. Verified by reproducing the exact CI combination locally (Python 3.13, Sphinx 6.2.1, pydata-sphinx-theme 0.20.0, sphinx-book-theme 1.4.0): - before: 6 failed, 6 passed in tests/test_gateddirective.py - after: 12 passed - full suite: 116 passed on that combination, and 116 passed on Sphinx 8.2.3 No regression fixtures needed regenerating, which confirms they are theme-independent. Co-Authored-By: Claude Fable 5 --- tests/books/test-gateddirective/conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/books/test-gateddirective/conf.py b/tests/books/test-gateddirective/conf.py index d81b3c2..5102a59 100644 --- a/tests/books/test-gateddirective/conf.py +++ b/tests/books/test-gateddirective/conf.py @@ -48,7 +48,11 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = "sphinx_book_theme" +# Use the built-in alabaster theme, as the other HTML test roots do. +# The regression fixtures only capture the exercise/solution markup this +# extension generates, so no third-party theme is needed to exercise them, +# and depending on one couples the suite to that theme's Sphinx support. +html_theme = "alabaster" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files,