-
-
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
Changes from 1 commit
e3f54d3
a06beb8
e5595fe
f83462f
3e8aa16
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 |
---|---|---|
|
@@ -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. """ | ||
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. There are spaces in the sides of this docstring |
||
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"}]) | ||
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. We use singlequotes |
||
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 |
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.
Our style guide is something like