-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Use default settings for Config object #5056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
593af88
da4a1c4
c57a0a4
12e7c35
f5fea83
5d7ead4
32e7559
c0dda3b
1b7912e
555f0fb
5891db3
b88b167
77102a1
7c905c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
from readthedocs.projects import tasks | ||
from readthedocs.projects.models import Feature, Project | ||
from readthedocs.rtd_tests.utils import create_git_submodule, make_git_repo | ||
from doc_builder.constants import DOCKER_IMAGE_SETTINGS | ||
|
||
|
||
def create_load(config=None): | ||
|
@@ -81,32 +82,37 @@ def test_python_supported_versions_default_image_1_0(self, load_config): | |
self.project.enable_pdf_build = True | ||
self.project.save() | ||
config = load_yaml_config(self.version) | ||
self.assertEqual(load_config.call_count, 1) | ||
load_config.assert_has_calls([ | ||
mock.call( | ||
|
||
expected_env_config = { | ||
'allow_v2': mock.ANY, | ||
'build': {'image': 'readthedocs/build:1.0'}, | ||
'output_base': '', | ||
'name': mock.ANY, | ||
dojutsu-user marked this conversation as resolved.
Show resolved
Hide resolved
|
||
'defaults': { | ||
'install_project': self.project.install_project, | ||
'formats': [ | ||
'htmlzip', | ||
'epub', | ||
'pdf' | ||
], | ||
'use_system_packages': self.project.use_system_packages, | ||
'requirements_file': self.project.requirements_file, | ||
'python_version': 2, | ||
'sphinx_configuration': mock.ANY, | ||
'build_image': 'readthedocs/build:1.0', | ||
'doctype': self.project.documentation_type, | ||
}, | ||
} | ||
|
||
img_settings = DOCKER_IMAGE_SETTINGS.get(self.project.container_image, None) | ||
if img_settings: | ||
expected_env_config.update(img_settings) | ||
expected_env_config['DOCKER_IMAGE_SETTINGS'] = img_settings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't follow why we are updating the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the value of {
...
...
'python': {'supported_versions': [2, 2.7, 3, 3.4]},
...
...
'DOCKER_IMAGE_SETTINGS': {'python': {'supported_versions': [2, 2.7, 3, 3.4]}},
...
...
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we need to refactor the code to only have/use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just removed the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this was added in #3339. I'm investigating more, but it looks like it was for doing what we are doing now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just opened #5116 to have this more clear, after that PR is merged, it should be easier to see what parts of the code remove/replace. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
load_config.assert_called_once_with( | ||
path=mock.ANY, | ||
env_config={ | ||
'allow_v2': mock.ANY, | ||
'build': {'image': 'readthedocs/build:1.0'}, | ||
'output_base': '', | ||
'name': mock.ANY, | ||
'defaults': { | ||
'install_project': self.project.install_project, | ||
'formats': [ | ||
'htmlzip', | ||
'epub', | ||
'pdf' | ||
], | ||
'use_system_packages': self.project.use_system_packages, | ||
'requirements_file': self.project.requirements_file, | ||
'python_version': 2, | ||
'sphinx_configuration': mock.ANY, | ||
'build_image': 'readthedocs/build:1.0', | ||
'doctype': self.project.documentation_type, | ||
}, | ||
}, | ||
), | ||
]) | ||
env_config=expected_env_config, | ||
) | ||
self.assertEqual(config.python.version, 2) | ||
|
||
@mock.patch('readthedocs.doc_builder.config.load_config') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,7 +268,26 @@ def USE_PROMOS(self): # noqa | |
|
||
# Docker | ||
DOCKER_ENABLE = False | ||
DOCKER_IMAGE = 'readthedocs/build:2.0' | ||
DOCKER_DEFAULT_IMAGE = 'readthedocs/build' | ||
DOCKER_DEFAULT_VERSION = '2.0' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
DOCKER_IMAGE = '{}:{}'.format(DOCKER_DEFAULT_IMAGE, DOCKER_DEFAULT_VERSION) | ||
DOCKER_IMAGE_SETTINGS = { | ||
'readthedocs/build:1.0': { | ||
'python': {'supported_versions': [2, 2.7, 3, 3.4]}, | ||
}, | ||
'readthedocs/build:2.0': { | ||
'python': {'supported_versions': [2, 2.7, 3, 3.5]}, | ||
}, | ||
'readthedocs/build:3.0': { | ||
'python': {'supported_versions': [2, 2.7, 3, 3.3, 3.4, 3.5, 3.6]}, | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 'readthedocs/build:4.0': {
'python': {'supported_versions': [2, 2.7, 3, 3.5, 3.6, 3.7]},
}, has to be added here. |
||
'readthedocs/build:stable': { | ||
'python': {'supported_versions': [2, 2.7, 3, 3.3, 3.4, 3.5, 3.6]}, | ||
}, | ||
'readthedocs/build:latest': { | ||
'python': {'supported_versions': [2, 2.7, 3, 3.3, 3.4, 3.5, 3.6]}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}, | ||
} | ||
|
||
# All auth | ||
ACCOUNT_ADAPTER = 'readthedocs.core.adapters.AccountAdapter' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should default to
3.0
now that we already deploy/release it.