5
5
from sphinx .application import Sphinx
6
6
from sphinx .errors import ExtensionError
7
7
from pathlib import Path
8
+ import shutil
8
9
import logging
9
10
10
11
from conftest import rel2url
@@ -27,6 +28,16 @@ def test_simple(self, app: Sphinx, ensure_redirect):
27
28
assert app .statuscode == 0
28
29
ensure_redirect ("another.html" , "index.html" )
29
30
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
+
30
41
@pytest .mark .sphinx ("html" , testroot = "no_cycle" )
31
42
def test_no_cycle (self , app : Sphinx , ensure_redirect ):
32
43
app .build ()
@@ -211,6 +222,16 @@ def test_simple(self, app: Sphinx, ensure_redirect):
211
222
assert app .statuscode == 0
212
223
ensure_redirect ("another/index.html" , "index.html" )
213
224
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
+
214
235
@pytest .mark .sphinx ("dirhtml" , testroot = "no_cycle" )
215
236
def test_no_cycle (self , app : Sphinx , ensure_redirect ):
216
237
app .build ()
0 commit comments