Skip to content

Commit da2aa34

Browse files
committed
rework get_mkdocs_yaml_path
1 parent 0a50bef commit da2aa34

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

readthedocs/builds/models.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Models for the builds app."""
2-
32
import datetime
43
import os.path
54
import re
@@ -86,6 +85,7 @@
8685

8786

8887
class Version(TimeStampedModel):
88+
8989
"""Version of a ``Project``."""
9090

9191
project = models.ForeignKey(
@@ -540,6 +540,12 @@ def get_conf_py_path(self):
540540
conf_py_path = os.path.relpath(conf_py_path, checkout_prefix)
541541
return conf_py_path
542542

543+
def get_mkdocs_yml_path(self):
544+
mkdocs_yml_path = self.project.yaml_dir(self.slug)
545+
checkout_prefix = self.project.checkout_path(self.slug)
546+
mkdocs_yml_path = os.path.relpath(mkdocs_yml_path, checkout_prefix)
547+
return mkdocs_yml_path
548+
543549
def get_storage_paths(self, version_slug=None):
544550
"""
545551
Return a list of all build artifact storage paths for this version.
@@ -567,6 +573,7 @@ def get_storage_paths(self, version_slug=None):
567573

568574

569575
class APIVersion(Version):
576+
570577
"""
571578
Version proxy model for API data deserialization.
572579
@@ -618,6 +625,7 @@ def save(self, *args, **kwargs):
618625

619626

620627
class Build(models.Model):
628+
621629
"""Build data."""
622630

623631
project = models.ForeignKey(
@@ -1013,6 +1021,7 @@ def reset(self):
10131021

10141022

10151023
class BuildCommandResultMixin:
1024+
10161025
"""
10171026
Mixin for common command result methods/properties.
10181027
@@ -1036,6 +1045,7 @@ def failed(self):
10361045

10371046

10381047
class BuildCommandResult(BuildCommandResultMixin, models.Model):
1048+
10391049
"""Build command for a ``Build``."""
10401050

10411051
build = models.ForeignKey(
@@ -1068,6 +1078,7 @@ def run_time(self):
10681078

10691079

10701080
class VersionAutomationRule(PolymorphicModel, TimeStampedModel):
1081+
10711082
"""Versions automation rules for projects."""
10721083

10731084
ACTIVATE_VERSION_ACTION = "activate-version"

readthedocs/rtd_tests/tests/test_doc_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def setUp(self):
128128
self.build_env.project = self.project
129129
self.build_env.version = self.version
130130
self.build_env.build = {
131-
"id": 123,
131+
"id": 456,
132132
}
133133
self.build_env.api_client = mock.MagicMock()
134134

@@ -145,7 +145,7 @@ def test_project_without_mkdocs_yaml(
145145
self,
146146
load_yaml_config,
147147
checkout_path,
148-
get_mkdocs_yaml_path,
148+
get_mkdocs_yml_path,
149149
_,
150150
docs_dir,
151151
):
@@ -158,7 +158,7 @@ def test_project_without_mkdocs_yaml(
158158
tmp_dir = tempfile.mkdtemp()
159159
checkout_path.return_value = tmp_dir
160160
docs_dir.return_value = tmp_dir
161-
get_mkdocs_yaml_path.side_effect = MkDocsYAMLParseError
161+
get_mkdocs_yml_path.side_effect = MkDocsYAMLParseError
162162
python_env = Virtualenv(
163163
version=self.version,
164164
build_env=self.build_env,

0 commit comments

Comments
 (0)