@@ -1316,7 +1316,10 @@ def test_sphinx_is_default_doc_type(self):
1316
1316
('htmldir' , 'sphinx_htmldir' ),
1317
1317
('singlehtml' , 'sphinx_singlehtml' )])
1318
1318
def test_sphinx_builder_check_valid (self , value , expected ):
1319
- build = self .get_build_config ({'sphinx' : {'builder' : value }})
1319
+ build = self .get_build_config (
1320
+ {'sphinx' : {'builder' : value }},
1321
+ {'defaults' : {'doctype' : expected }},
1322
+ )
1320
1323
build .validate ()
1321
1324
assert build .sphinx .builder == expected
1322
1325
assert build .doctype == expected
@@ -1333,6 +1336,7 @@ def test_sphinx_builder_default(self):
1333
1336
build .validate ()
1334
1337
build .sphinx .builder == 'sphinx'
1335
1338
1339
+ @pytest .mark .skip
1336
1340
def test_sphinx_builder_ignores_default (self ):
1337
1341
build = self .get_build_config (
1338
1342
{},
@@ -1454,6 +1458,7 @@ def test_mkdocs_configuration_check_valid(self, tmpdir):
1454
1458
apply_fs (tmpdir , {'mkdocs.yml' : '' })
1455
1459
build = self .get_build_config (
1456
1460
{'mkdocs' : {'configuration' : 'mkdocs.yml' }},
1461
+ {'defaults' : {'doctype' : 'mkdocs' }},
1457
1462
source_file = str (tmpdir .join ('readthedocs.yml' )),
1458
1463
)
1459
1464
build .validate ()
@@ -1472,40 +1477,67 @@ def test_mkdocs_configuration_check_invalid(self, tmpdir):
1472
1477
assert excinfo .value .key == 'mkdocs.configuration'
1473
1478
1474
1479
def test_mkdocs_configuration_allow_null (self ):
1475
- build = self .get_build_config ({'mkdocs' : {'configuration' : None }},)
1480
+ build = self .get_build_config (
1481
+ {'mkdocs' : {'configuration' : None }},
1482
+ {'defaults' : {'doctype' : 'mkdocs' }},
1483
+ )
1476
1484
build .validate ()
1477
1485
assert build .mkdocs .configuration is None
1478
1486
1479
1487
def test_mkdocs_configuration_check_default (self ):
1480
- build = self .get_build_config ({'mkdocs' : {}})
1488
+ build = self .get_build_config (
1489
+ {'mkdocs' : {}},
1490
+ {'defaults' : {'doctype' : 'mkdocs' }},
1491
+ )
1481
1492
build .validate ()
1482
1493
assert build .mkdocs .configuration is None
1483
1494
1484
1495
@pytest .mark .parametrize ('value' , [[], True , 0 , {}])
1485
1496
def test_mkdocs_configuration_validate_type (self , value ):
1486
- build = self .get_build_config ({'mkdocs' : {'configuration' : value }},)
1497
+ build = self .get_build_config (
1498
+ {'mkdocs' : {'configuration' : value }},
1499
+ {'defaults' : {'doctype' : 'mkdocs' }},
1500
+ )
1487
1501
with raises (InvalidConfig ) as excinfo :
1488
1502
build .validate ()
1489
1503
assert excinfo .value .key == 'mkdocs.configuration'
1490
1504
1491
1505
@pytest .mark .parametrize ('value' , [True , False ])
1492
1506
def test_mkdocs_fail_on_warning_check_valid (self , value ):
1493
- build = self .get_build_config ({'mkdocs' : {'fail_on_warning' : value }})
1507
+ build = self .get_build_config (
1508
+ {'mkdocs' : {'fail_on_warning' : value }},
1509
+ {'defaults' : {'doctype' : 'mkdocs' }},
1510
+ )
1494
1511
build .validate ()
1495
1512
assert build .mkdocs .fail_on_warning is value
1496
1513
1497
1514
@pytest .mark .parametrize ('value' , [[], 'invalid' , 5 ])
1498
1515
def test_mkdocs_fail_on_warning_check_invalid (self , value ):
1499
- build = self .get_build_config ({'mkdocs' : {'fail_on_warning' : value }})
1516
+ build = self .get_build_config (
1517
+ {'mkdocs' : {'fail_on_warning' : value }},
1518
+ {'defaults' : {'doctype' : 'mkdocs' }},
1519
+ )
1500
1520
with raises (InvalidConfig ) as excinfo :
1501
1521
build .validate ()
1502
1522
assert excinfo .value .key == 'mkdocs.fail_on_warning'
1503
1523
1504
1524
def test_mkdocs_fail_on_warning_check_default (self ):
1505
- build = self .get_build_config ({'mkdocs' : {}})
1525
+ build = self .get_build_config (
1526
+ {'mkdocs' : {}},
1527
+ {'defaults' : {'doctype' : 'mkdocs' }},
1528
+ )
1506
1529
build .validate ()
1507
1530
assert build .mkdocs .fail_on_warning is False
1508
1531
1532
+ def test_validates_different_filetype (self ):
1533
+ build = self .get_build_config (
1534
+ {'mkdocs' : {}},
1535
+ {'defaults' : {'doctype' : 'sphinx' }},
1536
+ )
1537
+ with raises (InvalidConfig ) as excinfo :
1538
+ build .validate ()
1539
+ assert excinfo .value .key == 'mkdocs'
1540
+
1509
1541
@pytest .mark .parametrize ('value' , [[], 'invalid' , 0 ])
1510
1542
def test_submodules_check_invalid_type (self , value ):
1511
1543
build = self .get_build_config ({'submodules' : value })
0 commit comments