Add start and termination to YAML file regex (#4584)
* Add start and termination to YAML file regex Otherwise it found files like: .hg/store/data/readthedocs.yml.i * Update common submodule * Tests (#4587)agj/add-local-dev-docker
parent
b6bd7a66bf
commit
dcb4270a62
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit 5abc1d31f84c615dbfc060fd671efd85aade01f7
|
||||
Subproject commit 9d653630c7285f8f2ec2deb06cb473e4ad6e0700
|
|
@ -31,7 +31,7 @@ __all__ = (
|
|||
)
|
||||
|
||||
ALL = 'all'
|
||||
CONFIG_FILENAME_REGEX = r'\.?readthedocs.ya?ml'
|
||||
CONFIG_FILENAME_REGEX = r'^\.?readthedocs.ya?ml$'
|
||||
|
||||
CONFIG_NOT_SUPPORTED = 'config-not-supported'
|
||||
VERSION_INVALID = 'version-invalid'
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from __future__ import division, print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import textwrap
|
||||
import re
|
||||
import textwrap
|
||||
|
||||
import pytest
|
||||
from mock import DEFAULT, patch
|
||||
|
@ -13,8 +13,8 @@ from readthedocs.config import (
|
|||
ALL, BuildConfigV1, BuildConfigV2, ConfigError,
|
||||
ConfigOptionNotSupportedError, InvalidConfig, ProjectConfig, load)
|
||||
from readthedocs.config.config import (
|
||||
CONFIG_NOT_SUPPORTED, NAME_INVALID, NAME_REQUIRED, PYTHON_INVALID,
|
||||
VERSION_INVALID, CONFIG_FILENAME_REGEX)
|
||||
CONFIG_FILENAME_REGEX, CONFIG_NOT_SUPPORTED, CONFIG_REQUIRED, NAME_INVALID,
|
||||
NAME_REQUIRED, PYTHON_INVALID, VERSION_INVALID)
|
||||
from readthedocs.config.models import Conda
|
||||
from readthedocs.config.validation import (
|
||||
INVALID_BOOL, INVALID_CHOICE, INVALID_LIST, INVALID_PATH, INVALID_STRING)
|
||||
|
@ -81,10 +81,20 @@ def get_env_config(extra=None):
|
|||
return defaults
|
||||
|
||||
|
||||
def test_load_no_config_file(tmpdir):
|
||||
@pytest.mark.parametrize('files', [
|
||||
{},
|
||||
{'readthedocs.ymlmore': ''},
|
||||
{'startreadthedocs.yml': ''},
|
||||
{'noroot': {'readthedocs.ymlmore': ''}},
|
||||
{'noroot': {'startreadthedocs.yml': ''}},
|
||||
{'readthebots.yaml': ''},
|
||||
])
|
||||
def test_load_no_config_file(tmpdir, files):
|
||||
apply_fs(tmpdir, files)
|
||||
base = str(tmpdir)
|
||||
with raises(ConfigError):
|
||||
with raises(ConfigError) as e:
|
||||
load(base, env_config)
|
||||
assert e.value.code == CONFIG_REQUIRED
|
||||
|
||||
|
||||
def test_load_empty_config_file(tmpdir):
|
||||
|
|
Loading…
Reference in New Issue