Skip to content

Commit e5bd237

Browse files
authored
Remove some feature flags (#7846)
* Remove STORE_PAGEVIEWS feature * Remove FORCE_SPHINX_FROM_VENV
1 parent f4875a2 commit e5bd237

File tree

7 files changed

+7
-42
lines changed

7 files changed

+7
-42
lines changed

readthedocs/analytics/proxied_api.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from readthedocs.api.v2.permissions import IsAuthorizedToViewVersion
1313
from readthedocs.core.unresolver import unresolve_from_request
1414
from readthedocs.core.utils.extend import SettingsOverrideObject
15-
from readthedocs.projects.models import Feature, Project
15+
from readthedocs.projects.models import Project
1616

1717

1818
class BaseAnalyticsView(APIView):
@@ -62,9 +62,6 @@ def get(self, request, *args, **kwargs):
6262
# pylint: disable=no-self-use
6363
def increase_page_view_count(self, request, project, version, absolute_uri):
6464
"""Increase the page view count for the given project."""
65-
if not absolute_uri or not project.has_feature(Feature.STORE_PAGEVIEWS):
66-
return
67-
6865
unresolved = unresolve_from_request(request, absolute_uri)
6966
if not unresolved:
7067
return

readthedocs/analytics/tests.py

-11
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,6 @@ def test_increase_page_view_count(self):
123123
PageView.objects.all().count() == 0
124124
), 'There\'s no PageView object created yet.'
125125

126-
# Without the feature flag, no PageView is created
127-
self.client.get(self.url, HTTP_HOST=self.host)
128-
assert (
129-
PageView.objects.all().count() == 0
130-
)
131-
132-
feature, _ = Feature.objects.get_or_create(
133-
feature_id=Feature.STORE_PAGEVIEWS,
134-
)
135-
self.project.feature_set.add(feature)
136-
137126
# testing for yesterday
138127
with mock.patch('readthedocs.analytics.tasks.timezone.now') as mocked_timezone:
139128
mocked_timezone.return_value = self.yesterday

readthedocs/doc_builder/backends/sphinx.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,10 @@ def build(self):
282282
return cmd_ret.successful
283283

284284
def get_sphinx_cmd(self):
285-
if self.project.has_feature(Feature.FORCE_SPHINX_FROM_VENV):
286-
return (
287-
self.python_env.venv_bin(filename='python'),
288-
'-m',
289-
'sphinx',
290-
)
291285
return (
292-
'python',
293-
self.python_env.venv_bin(filename='sphinx-build'),
286+
self.python_env.venv_bin(filename='python'),
287+
'-m',
288+
'sphinx',
294289
)
295290

296291
def sphinx_parallel_arg(self):

readthedocs/projects/models.py

-10
Original file line numberDiff line numberDiff line change
@@ -1596,10 +1596,8 @@ def add_features(sender, **kwargs):
15961596
INDEX_FROM_HTML_FILES = 'index_from_html_files'
15971597
SEARCH_SUBPROJECTS_ON_DEFAULT_VERSION = 'search_subprojects_on_default_version'
15981598

1599-
FORCE_SPHINX_FROM_VENV = 'force_sphinx_from_venv'
16001599
LIST_PACKAGES_INSTALLED_ENV = 'list_packages_installed_env'
16011600
VCS_REMOTE_LISTING = 'vcs_remote_listing'
1602-
STORE_PAGEVIEWS = 'store_pageviews'
16031601
SPHINX_PARALLEL = 'sphinx_parallel'
16041602
USE_SPHINX_BUILDERS = 'use_sphinx_builders'
16051603
DEDUPLICATE_BUILDS = 'deduplicate_builds'
@@ -1726,10 +1724,6 @@ def add_features(sender, **kwargs):
17261724
),
17271725
),
17281726

1729-
(
1730-
FORCE_SPHINX_FROM_VENV,
1731-
_('Force to use Sphinx from the current virtual environment'),
1732-
),
17331727
(
17341728
LIST_PACKAGES_INSTALLED_ENV,
17351729
_(
@@ -1741,10 +1735,6 @@ def add_features(sender, **kwargs):
17411735
VCS_REMOTE_LISTING,
17421736
_('Use remote listing in VCS (e.g. git ls-remote) if supported for sync versions'),
17431737
),
1744-
(
1745-
STORE_PAGEVIEWS,
1746-
_('Store pageviews for this project'),
1747-
),
17481738
(
17491739
SPHINX_PARALLEL,
17501740
_('Use "-j auto" when calling sphinx-build'),

readthedocs/projects/views/private.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ def get_context_data(self, **kwargs):
11311131

11321132
def _is_enabled(self, project):
11331133
"""Should we show traffic analytics for this project?"""
1134-
return project.has_feature(Feature.STORE_PAGEVIEWS)
1134+
return True
11351135

11361136

11371137
class TrafficAnalyticsView(SettingsOverrideObject):

readthedocs/rtd_tests/tests/test_builds.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def test_build(self, load_config):
7373
self.assertEqual(self.mocks.popen.call_count, 1)
7474
cmd = self.mocks.popen.call_args_list[0][0]
7575
self.assertRegex(cmd[0][0], r'python')
76-
self.assertRegex(cmd[0][1], r'sphinx-build')
76+
self.assertRegex(cmd[0][1], '-m')
77+
self.assertRegex(cmd[0][2], 'sphinx')
7778

7879
@mock.patch('readthedocs.doc_builder.config.load_config')
7980
def test_build_respects_pdf_flag(self, load_config):

readthedocs/rtd_tests/tests/test_footer.py

-7
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,6 @@ def setUp(self):
452452
)
453453
self.host = 'pip.readthedocs.io'
454454

455-
# Run tests with all available features
456-
# that can increase the number of queries.
457-
feature, _ = Feature.objects.get_or_create(
458-
feature_id=Feature.STORE_PAGEVIEWS,
459-
)
460-
self.pip.feature_set.add(feature)
461-
462455
def test_version_queries(self):
463456
with self.assertNumQueries(self.EXPECTED_QUERIES):
464457
response = self.client.get(self.url, HTTP_HOST=self.host)

0 commit comments

Comments
 (0)