17
17
See the License for the specific language governing permissions and
18
18
limitations under the License.
19
19
"""
20
+ import os .path as osp
20
21
import re
21
22
import bs4
22
23
import pytest
@@ -36,7 +37,7 @@ def in_between(full, sub, s0, *others):
36
37
37
38
38
39
def get_html (app , fname ):
39
- with open (app .outdir + '/' + fname ) as f :
40
+ with open (osp . join ( str ( app .outdir ), fname ) ) as f :
40
41
return f .read ()
41
42
42
43
@@ -207,7 +208,7 @@ def test_module_nosignatures(self, app):
207
208
208
209
def test_class (self , app ):
209
210
app .build ()
210
- html = get_html (app , '/ test_class.html' )
211
+ html = get_html (app , 'test_class.html' )
211
212
212
213
if sphinx_version [:2 ] > [3 , 1 ]:
213
214
assert in_autosummary ("instance_attribute" , html )
@@ -259,7 +260,7 @@ def test_class(self, app):
259
260
)
260
261
def test_class_order (self , app ):
261
262
app .build ()
262
- html = get_html (app , '/ test_class_order.html' )
263
+ html = get_html (app , 'test_class_order.html' )
263
264
264
265
if sphinx_version [:2 ] > [3 , 1 ]:
265
266
assert in_autosummary ("instance_attribute" , html )
@@ -276,7 +277,7 @@ def test_class_order(self, app):
276
277
277
278
def test_class_summary_only (self , app ):
278
279
app .build ()
279
- html = get_html (app , '/ test_class_summary_only.html' )
280
+ html = get_html (app , 'test_class_summary_only.html' )
280
281
281
282
if sphinx_version [:2 ] > [3 , 1 ]:
282
283
assert in_autosummary ("instance_attribute" , html )
@@ -300,7 +301,7 @@ def test_class_summary_only(self, app):
300
301
301
302
def test_class_nosignatures (self , app ):
302
303
app .build ()
303
- html = get_html (app , '/ test_class_nosignatures.html' )
304
+ html = get_html (app , 'test_class_nosignatures.html' )
304
305
305
306
if sphinx_version [:2 ] > [3 , 1 ]:
306
307
assert in_autosummary ("instance_attribute" , html )
@@ -326,7 +327,7 @@ def test_class_nosignatures(self, app):
326
327
327
328
def test_inherited (self , app ):
328
329
app .build ()
329
- html = get_html (app , '/ test_inherited.html' )
330
+ html = get_html (app , 'test_inherited.html' )
330
331
assert in_autosummary ("test_method" , html )
331
332
332
333
@pytest .mark .xfail
@@ -341,7 +342,7 @@ def test_autoclasssumm_inline(self, app):
341
342
"""Test an AutoDocSummDirective inline."""
342
343
app .build ()
343
344
344
- html = get_html (app , '/ test_autoclasssumm_inline.html' )
345
+ html = get_html (app , 'test_autoclasssumm_inline.html' )
345
346
346
347
methods_title = "<strong>Methods:</strong>"
347
348
@@ -357,7 +358,7 @@ def test_autoclasssumm_inline(self, app):
357
358
def test_class_submodule (self , app ):
358
359
app .build ()
359
360
360
- html = get_html (app , '/ test_class_submodule.html' )
361
+ html = get_html (app , 'test_class_submodule.html' )
361
362
362
363
# check that hyperlink for instance method exists in summary table
363
364
assert re .findall (r'<td>.*href="#dummy_submodule\.submodule1'
@@ -366,7 +367,7 @@ def test_class_submodule(self, app):
366
367
def test_module_submodule (self , app ):
367
368
app .build ()
368
369
369
- html = get_html (app , '/ test_module_submodule.html' )
370
+ html = get_html (app , 'test_module_submodule.html' )
370
371
371
372
# check that hyperlink for class exists in summary table
372
373
assert re .findall (r'<td>.*href="#dummy_submodule\.submodule2'
@@ -384,7 +385,7 @@ def test_autoclasssumm(self, app):
384
385
"""Test building the autosummary of a class."""
385
386
app .build ()
386
387
387
- html = get_html (app , '/ test_autoclasssumm.html' )
388
+ html = get_html (app , 'test_autoclasssumm.html' )
388
389
389
390
# the class docstring must not be in the html
390
391
assert "Class test for autosummary" not in html
@@ -397,7 +398,7 @@ def test_autoclasssumm_no_titles(self, app):
397
398
"""Test building the autosummary of a class."""
398
399
app .build ()
399
400
400
- html = get_html (app , '/ test_autoclasssumm_no_titles.html' )
401
+ html = get_html (app , 'test_autoclasssumm_no_titles.html' )
401
402
402
403
# the class docstring must not be in the html
403
404
assert "Class test for autosummary" not in html
@@ -412,7 +413,7 @@ def test_autoclasssumm_some_sections(self, app):
412
413
"""Test building the autosummary of a class with some sections only."""
413
414
app .build ()
414
415
415
- html = get_html (app , '/ test_autoclasssumm_some_sections.html' )
416
+ html = get_html (app , 'test_autoclasssumm_some_sections.html' )
416
417
417
418
# the class docstring must not be in the html
418
419
assert "Class test for autosummary" not in html
@@ -426,7 +427,7 @@ def test_autoclasssumm_nosignatures(self, app):
426
427
"""Test building the autosummary of a class without signatures."""
427
428
app .build ()
428
429
429
- html = get_html (app , '/ test_autoclasssumm_nosignatures.html' )
430
+ html = get_html (app , 'test_autoclasssumm_nosignatures.html' )
430
431
431
432
# the class docstring must not be in the html
432
433
assert "Class test for autosummary" not in html
@@ -441,7 +442,7 @@ def test_automodulesumm(self, app):
441
442
"""Test building the autosummary of a module."""
442
443
app .build ()
443
444
444
- html = get_html (app , '/ test_automodulesumm.html' )
445
+ html = get_html (app , 'test_automodulesumm.html' )
445
446
446
447
# the class docstring must not be in the html
447
448
assert "Module for testing the autodocsumm" not in html
@@ -455,7 +456,7 @@ def test_automodulesumm_some_sections(self, app):
455
456
"""Test building the autosummary of a module with some sections only."""
456
457
app .build ()
457
458
458
- html = get_html (app , '/ test_automodulesumm_some_sections.html' )
459
+ html = get_html (app , 'test_automodulesumm_some_sections.html' )
459
460
460
461
# the class docstring must not be in the html
461
462
assert "Module for testing the autodocsumm" not in html
@@ -469,7 +470,7 @@ def test_automodulesumm_nosignatures(self, app):
469
470
"""Test building the autosummary of a module without signatures."""
470
471
app .build ()
471
472
472
- html = get_html (app , '/ test_automodulesumm_nosignatures.html' )
473
+ html = get_html (app , 'test_automodulesumm_nosignatures.html' )
473
474
474
475
# the class docstring must not be in the html
475
476
assert "Module for testing the autodocsumm" not in html
@@ -484,6 +485,6 @@ def test_automodulesumm_nosignatures(self, app):
484
485
def test_empty (self , app ):
485
486
app .build ()
486
487
487
- html = get_html (app , '/ test_empty.html' )
488
+ html = get_html (app , 'test_empty.html' )
488
489
489
490
assert not in_autosummary ("product" , html )
0 commit comments