File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -26,3 +26,18 @@ This directory contains the Python tests for the theme. These tests are built wi
2626The [ "Kitchen Sink" examples] ( https://pydata-sphinx-theme.readthedocs.io/en/stable/examples/kitchen-sink/index.html )
2727are taken from [ sphinx-themes.org] ( https://sphinx-themes.org/ ) and showcase
2828components of the PyData Sphinx Theme, such as admonitions, lists, and headings.
29+
30+ ## visually debugging the test pages
31+
32+ It can be useful to build and inspect the test pages in the browser.
33+
34+ By default ` nox -s test ` will build the html in a temporary directory.
35+ You can change this by using the ` PST_TEST_HTML_DIR ` environment variable.
36+
37+ For example:
38+
39+ ```
40+ $ PST_TEST_HTML_DIR=./debug-test-theme/ nox -s test
41+ ```
42+
43+ Will save all the generated html in the folders ` ./debug-test-theme/<test-name>/<site-name> `
Original file line number Diff line number Diff line change 11"""Configuration of the pytest session."""
22
33import re
4+ from os import environ
45from pathlib import Path
56from shutil import copytree
67from typing import Callable
@@ -65,11 +66,15 @@ def html_tree(self, *path) -> str:
6566
6667
6768@pytest .fixture ()
68- def sphinx_build_factory (make_app : Callable , tmp_path : Path ) -> Callable :
69+ def sphinx_build_factory (make_app : Callable , tmp_path : Path , request ) -> Callable :
6970 """Return a factory builder pointing to the tmp directory."""
7071
71- def _func (src_folder : Path , ** kwargs ) -> SphinxBuild :
72+ def _func (src_folder : str , ** kwargs ) -> SphinxBuild :
7273 """Create the Sphinxbuild from the source folder."""
74+ no_temp = environ .get ("PST_TEST_HTML_DIR" , None )
75+ nonlocal tmp_path
76+ if no_temp is not None :
77+ tmp_path = Path (no_temp ) / request .node .name / str (src_folder )
7378 srcdir = tmp_path / src_folder
7479 if sphinx .version_info < (7 , 2 ):
7580 from sphinx .testing .path import path as sphinx_path
You can’t perform that action at this time.
0 commit comments