Skip to content

Commit aa9bae6

Browse files
committed
External version name added
1 parent 37238a1 commit aa9bae6

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

readthedocs/builds/managers.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -149,24 +149,24 @@ class InternalBuildManagerBase(BuildManagerBase):
149149
"""
150150
Build manager that only includes internal version builds.
151151
152-
It will exclude PULL_REQUEST type Version builds from the queries
152+
It will exclude pull request/merge request version builds from the queries
153153
and only include BRANCH, TAG, UNKONWN type Version builds.
154154
"""
155155

156156
def get_queryset(self):
157-
return super().get_queryset().exclude(version__type=PULL_REQUEST)
157+
return super().get_queryset().exclude(version__type=EXTERNAL)
158158

159159

160160
class ExternalBuildManagerBase(BuildManagerBase):
161161

162162
"""
163163
Build manager that only includes external version builds.
164164
165-
It will only include PULL_REQUEST type Versions builds in the queries.
165+
It will only include pull request/merge request version builds in the queries.
166166
"""
167167

168168
def get_queryset(self):
169-
return super().get_queryset().filter(version__type=PULL_REQUEST)
169+
return super().get_queryset().filter(version__type=EXTERNAL)
170170

171171

172172
class BuildManager(SettingsOverrideObject):

readthedocs/builds/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ class Build(models.Model):
638638
objects = BuildManager.from_queryset(BuildQuerySet)()
639639
# Only include BRANCH, TAG, UNKONWN type Version builds.
640640
internal = InternalBuildManager.from_queryset(BuildQuerySet)()
641-
# Only include PULL_REQUEST type Version builds.
641+
# Only include EXTERNAL type Version builds.
642642
external = ExternalBuildManager.from_queryset(BuildQuerySet)()
643643

644644
CONFIG_KEY = '__config'

readthedocs/rtd_tests/tests/test_managers.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ def setUp(self):
134134
self.client.login(username='test_user', password='test')
135135
self.pip = Project.objects.get(slug='pip')
136136
print(self.pip.versions.all())
137-
# Create a External Version and build. ie: PULL_REQUEST type Version.
137+
# Create a External Version and build. ie: pull/merge request Version.
138138
self.pr_version = get(
139139
Version,
140140
project=self.pip,
141141
active=True,
142-
type=PULL_REQUEST,
142+
type=EXTERNAL,
143143
privacy_level=PUBLIC
144144
)
145145
self.pr_version_build = get(
@@ -154,15 +154,15 @@ def setUp(self):
154154
version=self.pip.versions.get(slug='0.8')
155155
)
156156

157-
self.internal_builds = Build.objects.exclude(version__type=PULL_REQUEST)
157+
self.internal_builds = Build.objects.exclude(version__type=EXTERNAL)
158158

159159

160160
class TestInternalBuildManager(TestBuildManagerBase):
161161

162162
"""
163163
Queries using Internal Manager should only include Internal Version builds.
164164
165-
It will exclude PULL_REQUEST type Version builds from the queries
165+
It will exclude pull/merge request Version builds from the queries
166166
and only include BRANCH, TAG, UNKONWN type Versions.
167167
"""
168168

@@ -187,7 +187,7 @@ class TestExternalBuildManager(TestBuildManagerBase):
187187
"""
188188
Queries using External Manager should only include External Version builds.
189189
190-
It will only include PULL_REQUEST type Version builds in the queries.
190+
It will only include pull/merge request Version builds in the queries.
191191
"""
192192

193193
def test_external_build_manager_with_all(self):

readthedocs/rtd_tests/tests/test_project.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_update_stable_version_excludes_pr_versions(self):
162162

163163
def test_has_good_build_excludes_pr_versions(self):
164164
# Delete all versions excluding PR Versions.
165-
self.pip.versions.exclude(type=PULL_REQUEST).delete()
165+
self.pip.versions.exclude(type=EXTERNAL).delete()
166166
# Test that PR Version is not considered for has_good_build.
167167
self.assertFalse(self.pip.has_good_build)
168168

readthedocs/rtd_tests/tests/test_views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django.urls import reverse
88
from django_dynamic_fixture import get, new
99

10-
from readthedocs.builds.constants import LATEST, PULL_REQUEST
10+
from readthedocs.builds.constants import LATEST, EXTERNAL
1111
from readthedocs.builds.models import Build, Version
1212
from readthedocs.core.permissions import AdminPermission
1313
from readthedocs.projects.forms import UpdateProjectForm
@@ -283,7 +283,7 @@ def test_build_list_does_not_include_pr_versions(self):
283283
Version,
284284
project = self.pip,
285285
active = True,
286-
type = PULL_REQUEST,
286+
type = EXTERNAL,
287287
)
288288
pr_version_build = get(
289289
Build,

0 commit comments

Comments
 (0)