55from sphinx .application import Sphinx
66from sphinx .errors import ExtensionError
77from pathlib import Path
8+ import shutil
89import logging
910
1011from conftest import rel2url
@@ -27,6 +28,16 @@ def test_simple(self, app: Sphinx, ensure_redirect):
2728 assert app .statuscode == 0
2829 ensure_redirect ("another.html" , "index.html" )
2930
31+ @pytest .mark .sphinx ("html" , testroot = "simple" )
32+ def test_simple_rebuild (self , app : Sphinx , ensure_redirect ):
33+ if Path (app .outdir ).exists ():
34+ shutil .rmtree (Path (app .outdir ))
35+ app .build ()
36+ assert app .statuscode == 0
37+ app .build ()
38+ assert app .statuscode == 0
39+ ensure_redirect ("another.html" , "index.html" )
40+
3041 @pytest .mark .sphinx ("html" , testroot = "no_cycle" )
3142 def test_no_cycle (self , app : Sphinx , ensure_redirect ):
3243 app .build ()
@@ -211,6 +222,16 @@ def test_simple(self, app: Sphinx, ensure_redirect):
211222 assert app .statuscode == 0
212223 ensure_redirect ("another/index.html" , "index.html" )
213224
225+ @pytest .mark .sphinx ("dirhtml" , testroot = "simple" , freshenv = False )
226+ def test_simple_rebuild (self , app : Sphinx , ensure_redirect ):
227+ if Path (app .outdir ).exists ():
228+ shutil .rmtree (Path (app .outdir ))
229+ app .build ()
230+ assert app .statuscode == 0
231+ app .build ()
232+ assert app .statuscode == 0
233+ ensure_redirect ("another/index.html" , "index.html" )
234+
214235 @pytest .mark .sphinx ("dirhtml" , testroot = "no_cycle" )
215236 def test_no_cycle (self , app : Sphinx , ensure_redirect ):
216237 app .build ()
0 commit comments