File tree 2 files changed +21
-2
lines changed
2 files changed +21
-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
26
26
The [ "Kitchen Sink" examples] ( https://pydata-sphinx-theme.readthedocs.io/en/stable/examples/kitchen-sink/index.html )
27
27
are taken from [ sphinx-themes.org] ( https://sphinx-themes.org/ ) and showcase
28
28
components 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 1
1
"""Configuration of the pytest session."""
2
2
3
3
import re
4
+ from os import environ
4
5
from pathlib import Path
5
6
from shutil import copytree
6
7
from typing import Callable
@@ -65,11 +66,14 @@ def html_tree(self, *path) -> str:
65
66
66
67
67
68
@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 :
69
70
"""Return a factory builder pointing to the tmp directory."""
70
71
71
- def _func (src_folder : Path , ** kwargs ) -> SphinxBuild :
72
+ def _func (src_folder : str , ** kwargs ) -> SphinxBuild :
72
73
"""Create the Sphinxbuild from the source folder."""
74
+ no_temp = environ .get ("PST_TEST_HTML_DIR" , None )
75
+ if no_temp is not None :
76
+ tmp_path = Path (no_temp ) / request .node .name / str (src_folder )
73
77
srcdir = tmp_path / src_folder
74
78
if sphinx .version_info < (7 , 2 ):
75
79
from sphinx .testing .path import path as sphinx_path
You can’t perform that action at this time.
0 commit comments