@@ -33,7 +33,7 @@ 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 ], path : Path , file_regression , normalize_doctree_xml
3737):
3838 """Test snippets written in RestructuredText (before post-transforms)."""
3939 builder = sphinx_builder (conf_kwargs = {"extensions" : ["sphinx_design" ]})
@@ -44,7 +44,7 @@ def test_snippets_rst(
4444 doctree = builder .get_doctree ("index" , post_transforms = False )
4545 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
4646 file_regression .check (
47- doctree .pformat (),
47+ normalize_doctree_xml ( doctree .pformat () ),
4848 basename = f"snippet_pre_{ path .name [: - len (path .suffix )]} " ,
4949 extension = ".xml" ,
5050 encoding = "utf8" ,
@@ -58,7 +58,7 @@ def test_snippets_rst(
5858)
5959@pytest .mark .skipif (not MYST_INSTALLED , reason = "myst-parser not installed" )
6060def test_snippets_myst (
61- sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression
61+ sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression , normalize_doctree_xml
6262):
6363 """Test snippets written in MyST Markdown (before post-transforms)."""
6464 builder = sphinx_builder ()
@@ -69,7 +69,7 @@ def test_snippets_myst(
6969 doctree = builder .get_doctree ("index" , post_transforms = False )
7070 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
7171 file_regression .check (
72- doctree .pformat (),
72+ normalize_doctree_xml ( doctree .pformat () ),
7373 basename = f"snippet_pre_{ path .name [: - len (path .suffix )]} " ,
7474 extension = ".xml" ,
7575 encoding = "utf8" ,
@@ -82,7 +82,7 @@ def test_snippets_myst(
8282 ids = [path .name [: - len (path .suffix )] for path in SNIPPETS_GLOB_RST ],
8383)
8484def test_snippets_rst_post (
85- sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression
85+ sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression , normalize_doctree_xml
8686):
8787 """Test snippets written in RestructuredText (after HTML post-transforms)."""
8888 builder = sphinx_builder (conf_kwargs = {"extensions" : ["sphinx_design" ]})
@@ -93,7 +93,7 @@ def test_snippets_rst_post(
9393 doctree = builder .get_doctree ("index" , post_transforms = True )
9494 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
9595 file_regression .check (
96- doctree .pformat (),
96+ normalize_doctree_xml ( doctree .pformat () ),
9797 basename = f"snippet_post_{ path .name [: - len (path .suffix )]} " ,
9898 extension = ".xml" ,
9999 encoding = "utf8" ,
@@ -107,7 +107,7 @@ def test_snippets_rst_post(
107107)
108108@pytest .mark .skipif (not MYST_INSTALLED , reason = "myst-parser not installed" )
109109def test_snippets_myst_post (
110- sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression
110+ sphinx_builder : Callable [..., SphinxBuilder ], path : Path , file_regression , normalize_doctree_xml
111111):
112112 """Test snippets written in MyST Markdown (after HTML post-transforms)."""
113113 builder = sphinx_builder ()
@@ -118,7 +118,7 @@ def test_snippets_myst_post(
118118 doctree = builder .get_doctree ("index" , post_transforms = True )
119119 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
120120 file_regression .check (
121- doctree .pformat (),
121+ normalize_doctree_xml ( doctree .pformat () ),
122122 basename = f"snippet_post_{ path .name [: - len (path .suffix )]} " ,
123123 extension = ".xml" ,
124124 encoding = "utf8" ,
@@ -164,7 +164,7 @@ def test_sd_hide_title_myst(
164164
165165@pytest .mark .skipif (not MYST_INSTALLED , reason = "myst-parser not installed" )
166166def test_sd_custom_directives (
167- sphinx_builder : Callable [..., SphinxBuilder ], file_regression
167+ sphinx_builder : Callable [..., SphinxBuilder ], file_regression , normalize_doctree_xml
168168):
169169 """Test that the defaults are used."""
170170 builder = sphinx_builder (
@@ -188,7 +188,7 @@ def test_sd_custom_directives(
188188 doctree = builder .get_doctree ("index" , post_transforms = False )
189189 doctree .attributes .pop ("translation_progress" , None ) # added in sphinx 7.1
190190 file_regression .check (
191- doctree .pformat (),
191+ normalize_doctree_xml ( doctree .pformat () ),
192192 basename = "sd_custom_directives" ,
193193 extension = ".xml" ,
194194 encoding = "utf8" ,
0 commit comments