-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Allow for period as a prefix and yaml extension for config file #4512
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e3f54d3
Allow for period as a prefix and yaml extension for config file
StefanoChiodino a06beb8
Changes to conform to readthedocs standards
StefanoChiodino e5595fe
Update test to use func new regex signature
StefanoChiodino f83462f
Remove extra lines
StefanoChiodino 3e8aa16
Merge remote-tracking branch 'upstream/master'
StefanoChiodino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
import os | ||
import textwrap | ||
import re | ||
|
||
import pytest | ||
from mock import DEFAULT, patch | ||
|
@@ -13,7 +14,7 @@ | |
ConfigOptionNotSupportedError, InvalidConfig, ProjectConfig, load) | ||
from readthedocs.config.config import ( | ||
CONFIG_NOT_SUPPORTED, NAME_INVALID, NAME_REQUIRED, PYTHON_INVALID, | ||
VERSION_INVALID) | ||
VERSION_INVALID, CONFIG_FILENAME_REGEX) | ||
from readthedocs.config.validation import ( | ||
INVALID_BOOL, INVALID_CHOICE, INVALID_LIST, INVALID_PATH, INVALID_STRING) | ||
|
||
|
@@ -49,6 +50,13 @@ | |
'nested': minimal_config_dir, | ||
} | ||
|
||
yaml_extension_config_dir = { | ||
'readthedocs.yaml': '''\ | ||
name: docs | ||
type: sphinx | ||
''' | ||
} | ||
|
||
|
||
def get_build_config(config, env_config=None, source_file='readthedocs.yml', | ||
source_position=0): | ||
|
@@ -137,6 +145,14 @@ def test_load_unknow_version(tmpdir): | |
assert excinfo.value.code == VERSION_INVALID | ||
|
||
|
||
def test_yaml_extension(tmpdir): | ||
"""Make sure it's capable of loading the 'readthedocs' file with a 'yaml' extension.""" | ||
apply_fs(tmpdir, yaml_extension_config_dir) | ||
base = str(tmpdir) | ||
config = load(base, env_config) | ||
assert len(config) == 1 | ||
|
||
|
||
def test_build_config_has_source_file(tmpdir): | ||
base = str(apply_fs(tmpdir, minimal_config_dir)) | ||
build = load(base, env_config)[0] | ||
|
@@ -790,6 +806,13 @@ def test_raise_config_not_supported(): | |
assert excinfo.value.code == CONFIG_NOT_SUPPORTED | ||
|
||
|
||
@pytest.mark.parametrize('correct_config_filename', | ||
[prefix + 'readthedocs.' + extension for prefix in {"", "."} | ||
for extension in {"yml", "yaml"}]) | ||
def test_config_filenames_regex(correct_config_filename): | ||
assert re.match(CONFIG_FILENAME_REGEX, correct_config_filename) | ||
|
||
|
||
class TestBuildConfigV2(object): | ||
|
||
def get_build_config(self, config, env_config=None, | ||
|
@@ -1620,3 +1643,6 @@ def test_submodules_recursive_explict_default(self): | |
assert build.submodules.include == [] | ||
assert build.submodules.exclude == [] | ||
assert build.submodules.recursive is False | ||
|
||
|
||
|
||
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 guess this extra lines shouldn't be here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 use singlequotes