Skip to content

Commit 3f311ef

Browse files
committed
Implement mkdocs key
1 parent 64cd38a commit 3f311ef

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

readthedocs/doc_builder/backends/mkdocs.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ def __init__(self, *args, **kwargs):
6161

6262
def get_yaml_config(self):
6363
"""Find the ``mkdocs.yml`` file in the project root."""
64-
# TODO: try to load from the configuration file first.
65-
test_path = os.path.join(
66-
self.project.checkout_path(self.version.slug),
67-
'mkdocs.yml'
68-
)
69-
if os.path.exists(test_path):
70-
return test_path
71-
return None
64+
mkdoc_path = self.config.mkdocs.configuration
65+
if not mkdoc_path:
66+
mkdoc_path = os.path.join(
67+
self.project.checkout_path(self.version.slug),
68+
'mkdocs.yml'
69+
)
70+
if not os.path.exists(mkdoc_path):
71+
return None
72+
return mkdoc_path
7273

7374
def load_yaml_config(self):
7475
"""
@@ -198,6 +199,8 @@ def build(self):
198199
'--site-dir', self.build_dir,
199200
'--config-file', self.yaml_file,
200201
]
202+
if self.config.mkdocs.fail_on_warning:
203+
build_command.append('--strict')
201204
if self.use_theme:
202205
build_command.extend(['--theme', 'readthedocs'])
203206
cmd_ret = self.run(

readthedocs/rtd_tests/tests/test_config_integration.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,6 @@ def test_sphinx_fail_on_warning(
728728
append_conf.assert_called_once()
729729
move.assert_called_once()
730730

731-
@pytest.mark.skip
732731
@patch('readthedocs.doc_builder.backends.mkdocs.BaseMkdocs.move')
733732
@patch('readthedocs.doc_builder.backends.mkdocs.BaseMkdocs.append_conf')
734733
@patch('readthedocs.doc_builder.backends.mkdocs.BaseMkdocs.run')
@@ -767,7 +766,6 @@ def test_mkdocs_configuration(
767766
append_conf.assert_called_once()
768767
move.assert_called_once()
769768

770-
@pytest.mark.skip
771769
@patch('readthedocs.doc_builder.backends.mkdocs.BaseMkdocs.move')
772770
@patch('readthedocs.doc_builder.backends.mkdocs.BaseMkdocs.append_conf')
773771
@patch('readthedocs.doc_builder.backends.mkdocs.BaseMkdocs.run')

0 commit comments

Comments
 (0)