@@ -33,7 +33,10 @@ def write_assets(src_path: Path):
3333 ids = [path .name [: - len (path .suffix )] for path in SNIPPETS_GLOB_RST ],
3434)
3535def test_snippets_rst (
36- sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression
36+ sphinx_builder : Callable [..., SphinxBuilder ],
37+ path : Path ,
38+ file_regression ,
39+ normalize_doctree_xml ,
3740):
3841 """Test snippets written in RestructuredText (before post-transforms)."""
3942 builder = sphinx_builder (conf_kwargs = {"extensions" : ["sphinx_design" ]})
@@ -44,7 +47,7 @@ def test_snippets_rst(
4447 doctree = builder .get_doctree ("index" , post_transforms = False )
4548 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
4649 file_regression .check (
47- doctree .pformat (),
50+ normalize_doctree_xml ( doctree .pformat () ),
4851 basename = f"snippet_pre_{ path .name [: - len (path .suffix )]} " ,
4952 extension = ".xml" ,
5053 encoding = "utf8" ,
@@ -58,7 +61,10 @@ def test_snippets_rst(
5861)
5962@pytest .mark .skipif (not MYST_INSTALLED , reason = "myst-parser not installed" )
6063def test_snippets_myst (
61- sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression
64+ sphinx_builder : Callable [..., SphinxBuilder ],
65+ path : Path ,
66+ file_regression ,
67+ normalize_doctree_xml ,
6268):
6369 """Test snippets written in MyST Markdown (before post-transforms)."""
6470 builder = sphinx_builder ()
@@ -69,7 +75,7 @@ def test_snippets_myst(
6975 doctree = builder .get_doctree ("index" , post_transforms = False )
7076 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
7177 file_regression .check (
72- doctree .pformat (),
78+ normalize_doctree_xml ( doctree .pformat () ),
7379 basename = f"snippet_pre_{ path .name [: - len (path .suffix )]} " ,
7480 extension = ".xml" ,
7581 encoding = "utf8" ,
@@ -82,7 +88,10 @@ def test_snippets_myst(
8288 ids = [path .name [: - len (path .suffix )] for path in SNIPPETS_GLOB_RST ],
8389)
8490def test_snippets_rst_post (
85- sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression
91+ sphinx_builder : Callable [..., SphinxBuilder ],
92+ path : Path ,
93+ file_regression ,
94+ normalize_doctree_xml ,
8695):
8796 """Test snippets written in RestructuredText (after HTML post-transforms)."""
8897 builder = sphinx_builder (conf_kwargs = {"extensions" : ["sphinx_design" ]})
@@ -93,7 +102,7 @@ def test_snippets_rst_post(
93102 doctree = builder .get_doctree ("index" , post_transforms = True )
94103 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
95104 file_regression .check (
96- doctree .pformat (),
105+ normalize_doctree_xml ( doctree .pformat () ),
97106 basename = f"snippet_post_{ path .name [: - len (path .suffix )]} " ,
98107 extension = ".xml" ,
99108 encoding = "utf8" ,
@@ -107,7 +116,10 @@ def test_snippets_rst_post(
107116)
108117@pytest .mark .skipif (not MYST_INSTALLED , reason = "myst-parser not installed" )
109118def test_snippets_myst_post (
110- sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression
119+ sphinx_builder : Callable [..., SphinxBuilder ],
120+ path : Path ,
121+ file_regression ,
122+ normalize_doctree_xml ,
111123):
112124 """Test snippets written in MyST Markdown (after HTML post-transforms)."""
113125 builder = sphinx_builder ()
@@ -118,7 +130,7 @@ def test_snippets_myst_post(
118130 doctree = builder .get_doctree ("index" , post_transforms = True )
119131 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
120132 file_regression .check (
121- doctree .pformat (),
133+ normalize_doctree_xml ( doctree .pformat () ),
122134 basename = f"snippet_post_{ path .name [: - len (path .suffix )]} " ,
123135 extension = ".xml" ,
124136 encoding = "utf8" ,
@@ -164,7 +176,7 @@ def test_sd_hide_title_myst(
164176
165177@pytest .mark .skipif (not MYST_INSTALLED , reason = "myst-parser not installed" )
166178def test_sd_custom_directives (
167- sphinx_builder : Callable [..., SphinxBuilder ], file_regression
179+ sphinx_builder : Callable [..., SphinxBuilder ], file_regression , normalize_doctree_xml
168180):
169181 """Test that the defaults are used."""
170182 builder = sphinx_builder (
@@ -188,7 +200,7 @@ def test_sd_custom_directives(
188200 doctree = builder .get_doctree ("index" , post_transforms = False )
189201 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
190202 file_regression .check (
191- doctree .pformat (),
203+ normalize_doctree_xml ( doctree .pformat () ),
192204 basename = "sd_custom_directives" ,
193205 extension = ".xml" ,
194206 encoding = "utf8" ,
0 commit comments